Skip to content

Commit e08aa1d

Browse files
Remove the unclarity about const variables (#5)
1 parent 0bab862 commit e08aa1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

03-javascript-features/02-let-and-const.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Both `let` and `const` are ES6 additions which use block scoping, instead of the traditional function scope used by `var`.
22

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.
44
const value = 'test'
55

66
// value = 'new value' //=> Error: Left-hand side of assignment expression cannot be a constant.
77

88
const array = [1, 2, 3]
99

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.
1111
for (let i = 0; i < array.length; i++) {
1212
console.log(array[i])
1313
}

0 commit comments

Comments
 (0)