You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// trying to create an age variable and then reassign the value by 1
2
2
3
-
constage=33;
3
+
//const age = 33;
4
+
letage=33;
4
5
age=age+1;
5
-
//problem: we cannot reassign a value to a variable that has been declared with "const". We can solve this problem by changing the declaration of the variable from "const" to "let", which allows us to reassign values to the variable. So we would change the first line to "let age = 33;".
6
+
console.log(age);
7
+
8
+
//problem: we cannot reassign a value to a variable that has been declared with "const". We can solve this problem by changing the declaration of the variable from "const" to "let", which allows us to reassign values to the variable. So I have commed line 3 and added line 4 to "let age = 33;". Also, I have added a line at the end to log the value of age to the console, so we can see the result of the reassignment to check that it is working correctly.
0 commit comments