The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.
Assign variables
A variable can be assigned the value of another variable.
let name1 = 'Olga';
let name2 = name1;
name1 = 'Clara';
In the second line, name2
is assigned the value of name1
.
The variable name2
gets the value 'Olga'
. This value is retained by name2
,
even if name1
receives a new value afterwards.Exercise
Which value does
x
have after execution of the following code?
let x = 'Laurel';
let y = 'Hardy';
let z = y;
y = x;
x = z;
+ Solution
'Hardy'