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
Copy file name to clipboardExpand all lines: 03-javascript-features/02-let-and-const.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
// Both `let` and `const` are ES6 additions which use block scoping, instead of the traditional function scope used by `var`.
2
2
3
-
// Using `const` helps greatly with readability and understandability. Any new programmer immediately knows this value is immutible - it won't be changed further down in the execution.
3
+
// Using `const` helps greatly with readability and understandability. Any new programmer immediately knows this value is a constant - it won't be changed further down in the execution.
4
4
constvalue='test'
5
5
6
6
// value = 'new value' //=> Error: Left-hand side of assignment expression cannot be a constant.
7
7
8
8
constarray=[1,2,3]
9
9
10
-
// I recommend only using `let` when the value is not immutable - such as in a loop.
10
+
// I recommend only using `let` when the value will be changed - such as in a loop.
0 commit comments