Skip to content

Commit 5c9289a

Browse files
committed
Change age variable from const to let to allow reassignment
1 parent d5dfe95 commit 5c9289a

File tree

1 file changed

+4
-1
lines changed
  • Sprint-1/2-mandatory-errors

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// trying to create an age variable and then reassign the value by 1
22

3-
const age = 33;
3+
let age = 33;
44
age = age + 1;
5+
console.log(age);
6+
7+
// Changed const to let because the variables value need to change during the program. const creates a fixed reference that cannot be reassigned. but let allows updating the variable which is required when incrementing or modifying values.

0 commit comments

Comments
 (0)