Mathematical Assignment Operators
VARIABLES Mathematical Assignment Operators Let’s consider how we can use variables and math operators to calculate new values and assign them to a variable. Check out the example below: let w = 4 ; w = w + 1 ; console . log ( w ); // Output: 5 In the example above, we created the variable w with the number 4 assigned to it. The following line, w = w + 1 , increases the value of w from 4 to 5 . Another way we could have reassigned w after performing some mathematical operation on it is to use built-in mathematical assignment operators . We could re-write the code above to be: let w = 4 ; w += 1 ; console . log ( w ); // Output: 5 In the second example, we used the += assignment operator to reassign w . We’re performing the mathematical operation of the first operator + using the number to the right, then reassigning w to the comput...