Skip to content

Commit 78c9889

Browse files
committed
fix(sprint-1): resolve TypeError by using let instead of const
1 parent d7626de commit 78c9889

File tree

1 file changed

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

1 file changed

+8
-1
lines changed

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

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

3-
const age = 33;
3+
// const age = 33;
4+
// age = age + 1;
5+
6+
// TypeError: Assignment to constant variable - `const` cannot be reassigned
7+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
8+
9+
// Solution:
10+
let age = 33;
411
age = age + 1;

0 commit comments

Comments
 (0)