Assignment JS2: JavaScript Assignment Statements and Programming





Part 1: Evaluate the following JavaScript Assignment Statements.






      // VARIABLES
      var MIN = 2;
      var MAX = 5;
      let y = 7
      let z = 2
      let x = 20
      let fNum = 100
      let t = 4
    Show the assignment values, or errors, that occur in the following sequence of instructions.

  1. x = Math.floor(y/z) + 4;
  2. x = x + y * 3;
  3. x = 2 / (t - 4);
  4. x = y % 3 + MIN / t + MAX;
  5. x = 3 - 4 * x;
  6. fNum = MAX / MIN;
  7. fNum = y % 2;
  8. 4 / 2 + fNum = fNum;
  9. y += z;
  10. MIN = MAX + 21/3;
  11. y = -10 / 2 % 4;





Part 2: Use the JavaScript Sandbox linked below to write the Height App program.



JavaScript online sandbox: https://codehs.com/explore/sandbox/javascript

Write the Height App program in JavaScript.
Code this program so that it prompts the user for their height in feet and inches.
After the user has input these two values, the program should then compute and display the user's height solely in inches.

Execute this JavaScript program three times, as follows:

Execution 1:
        For a height of 5 feet and 5 inches
        You are 65 inches tall.

Execution 2:
        For a height of 6 feet and 3.5 inches
        You are 75.5 inches tall.

Execution 3:
        For a height of 1 feet and 11 inches.
        You are 23 inches tall.