Iterating through the ordinary for in JavaScript
Arrays can also be iterated not through
the for-of
loop, but using
the ordinary for
:
let arr = [[1, 2, 3, 4, 5], [6, 7, 8], [9, 10]];
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
Solve the previous two tasks
through the loop for
.