Exercise Thursday

Goal: Practice bringing together everything we've learned in this section by creating a project that includes custom functions, branching, forms, jQuery, and well-separated user interface and business logic.

Warm Up


  • What is block scoping? Which variable initializers allows us to scope variables to a block?
  • Pausing on exceptions and setting breakpoints are both powerful tools from the browser DevTools debugger. When would we choose to set breakpoints to debug our code instead of the pausing on exceptions tool?

Code


Triangle Tracker

Make a web page that allows the user to input the lengths of the sides of a triangle, and returns whether these sides form an equilateral, isosceles, or scalene triangle or if the sides cannot make a triangle at all. Here are the definitions of each possibility:

  • Equilateral: All sides are equal.
  • Isosceles: Exactly 2 sides are equal.
  • Scalene: No sides are equal.
  • NOT a triangle: The sum of the lengths of any two sides of a triangle is less than or equal to the length of the third side.

Once your application is functioning correctly, try to refactor your code as much as possible.

Lesson 61 of 65
Last updated May 23, 2022