JavaScript Loops Explained: For Loop, While Loop, Do...while Loop…
https://www.freecodecamp.org/news/javascript-loops-explained-for-loop-for/
WEBFeb 15, 2020 · const array = [1, 2, 3]; for (const i in array) {. console.log(i); } // 0 // 1 // 2. But if something like a JS library you're using modifies the Array prototype directly, a for...in loop will iterate over that, too: const array = [1, 2, 3]; Array.prototype.someMethod = true; for (const i in array) {.
DA: 58 PA: 74 MOZ Rank: 17