JavaScript Simplified / Chapter 7 Exercises

  • Index of exercises
  • Email me

1

2

3

4

5

6

7

8

9

10

Congratulations. You've aced all the exercises for this chapter.


To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.


Are you ready to rate JavaScript Simplified? on Amazon?


Rate it on Amazon.

0,1,2,3,4,5,6,7,8,9

0

0

0

0

In the following statement, what is the value of num? let num = 5 – 1 * 4; 1 1
In the following statement, what is the value of num? let num = (5 – 1) * 4; 16 16
Addition and subtraction have lower precedence than multiplication, division, and ______. modulus modulus
The highest precedence is a group, defined by _______. (one word) parentheses parentheses
In the following statement, what is the value of num? let num = 4 + 4 / 2; 6 6
In the following statement, num winds up with a value of -1. What is the sign between 4 and 2? let num = 10 – 3 - 4 ? 2; * \*
Revise this so num winds up with a value of 36. let num = 4 + 2 * 6; let num = (4 + 2) * 6; letnum=\(4\+2\)\*6;
Revise this so num winds up with a value of -36. let num = 4 * 2 - (6 + 5); let num = 4 * (2 - (6 + 5)); letnum=4\*\(2-\(6\+5\)\);
  1. Assign to a variable a math operation where you use grouping to override other precedence rules.
  2. Display the value of the variable in an alert.
  3. Click the Result button (or, after revising, don't click, just wait).
  4. Wait a moment.
  5. If you've coded correctly, the value will display in an alert.
  6. Dismiss the alert by clicking OK.
  7. For help with this code, see Chapter 7 in the book.
  1. Assign to a variable a math operation where you use nested groups to override other precedence rules.
  2. Display the value of the variable in an alert.
  3. Click the Result button (or, after revising, don't click, just wait).
  4. Wait a moment.
  5. If you've coded correctly, the value will display in an alert.
  6. Dismiss the alert by clicking OK.
  7. For help with this code, see Chapter 7 in the book.