Skip to content

Commit adcbbf9

Browse files
authored
Change const to let for age variable reassignment
Updated variable declaration from const to let to allow reassignment.
1 parent 0f68f8b commit adcbbf9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • Sprint-2/2-mandatory-errors

‎Sprint-2/2-mandatory-errors/1.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
let age = 33;
44
age = age + 1;
5+
//a shorthand assignment operator
6+
//yes, +=
7+
//an error message shows up: TypeError: Assignment to constant variable.
58

6-
//we change the variable declaration and reassign its value
7-
// variable declaration keywords
8-
// const can't be used to reassign a value
9-
// let can be used to reassign a value
9+
//to solve this, we replace const with let to make the variable value changeable, then we run the program

0 commit comments

Comments
 (0)