mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 07:33:57 +00:00
PR changes: use const instead of let
This commit is contained in:
parent
1b67ecb30c
commit
ff3dd72359
@ -229,18 +229,18 @@ numbers = moreNumbers; // Error, mutating methods are missing
|
|||||||
// for..of statement
|
// for..of statement
|
||||||
// iterate over the list of values on the object being iterated
|
// iterate over the list of values on the object being iterated
|
||||||
let arrayOfAnyType = [1, "string", false];
|
let arrayOfAnyType = [1, "string", false];
|
||||||
for (let val of arrayOfAnyType) {
|
for (const val of arrayOfAnyType) {
|
||||||
console.log(val); // 1, "string", false
|
console.log(val); // 1, "string", false
|
||||||
}
|
}
|
||||||
|
|
||||||
let list = [4, 5, 6];
|
let list = [4, 5, 6];
|
||||||
for (let i of list) {
|
for (const i of list) {
|
||||||
console.log(i); // "4", "5", "6"
|
console.log(i); // "4", "5", "6"
|
||||||
}
|
}
|
||||||
|
|
||||||
// for..in statement
|
// for..in statement
|
||||||
// iterate over the list of keys on the object being iterated
|
// iterate over the list of keys on the object being iterated
|
||||||
for (let i in list) {
|
for (const i in list) {
|
||||||
console.log(i); // "0", "1", "2",
|
console.log(i); // "0", "1", "2",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user