4 ms·
> Interview question: "iterate over an array": for(let thing of things) {...} forEach only obfuscates the imperative nature of your loop.
by tomatsu 10y ago
> Interview question: "iterate over an array":
for(let thing of things) {...}
forEach only obfuscates the imperative nature of your loop.
- raverbashing 10y agoGood, but that's more modern for in, on the other hand is wrong https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of https://developer.mozilla.org/en/docs/Web/JavaScript/Referen... https://stackoverflow.com/questions/500504/why-is-using-for-in-with-array-iteration-a-bad-idea https://stackoverflow.com/questions/500504/why-is-using-for-...