In JavaScript, you can do something like this:
const arr = [1, 2, 3, 4, 5];
for (const v of arr) console.log(v);
But in normal for loop, it gives a TypeError
:
for (const i = 0; i < 5; i++) console.log(i);
// TypeError: Assignment to constant variable.
Shouldn't the for..of get an error as well?