Operations to change a variable in JavaScript

You can perform some operations on the current value of the variable, and then write the result back to the same variable. See an example:

let num = 1; // declare the variable num and write the value 1 to it num = num + 2; // write to num itself plus 2 alert(num); // shows 3

Without running the code, determine what will be displayed on the screen:

let num = 1; num = num + 1; num = num + 1; alert(num);

Without running the code, determine what will be displayed on the screen:

let num = 1; num = num + 2; num = num + 3; alert(num);
enru