Variable value changes

Suppose we have a variable to which we have assigned some value. We can apply again the assignment operation then and assign an another value to this variable:

let a; // declare a variable a = 1; // assign the value 1 to it alert(a); // shows 1 a = 2; // now assign the value 2, overwriting the value 1 alert(a); // shows 2

That is, the value of a variable is not something rigidly attached to it. We can freely write some data to a variable, read it, then write something else - and so on.

Create the variable a. Assign the value 10 to it, display it on the screen. Then write the value 20 into it, display it on the screen.

enru