Skip to content

Commit 8300538

Browse files
committed
changed const to let
1 parent cb64829 commit 8300538

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • Sprint-1/2-mandatory-errors

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
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;
55

6+
console.log(age)
67

78
// The error "Assignment to constant variable" occurs because const is used to declare a constant value that cannot be changed.
89
// Since the code tries to reassign the value on line 4 (age = age + 1), the program crashes.

0 commit comments

Comments
 (0)