I'm trying understand how the condition myArr[i] works. For some reason it evaluates to false when i is bigger than 2 which also happens to be the length of the array. Apparently myArr[i] is equal to i < myArr.length. Could someone explain?
let myArr = [[1, 3], [5, 2], [2, 1]]
for (let i = 0; myArr[i]; i++){
console.log(i) //Result: 0, 1, 2
}
let i = 0
while (myArr[i]){
console.log(i) ////Result: 0, 1, 2
i++
}
i < myArr.length. Try iterating an array like[{}, null, {}]or[true, false, true].