3 ms·
Why do that in the callback way at all? Why not simple for(const el of document.querySelectorAll('p')) {} Why have the overhead of a callback to begin wit
by Achshar 10y ago
Why do that in the callback way at all? Why not simple
for(const el of document.querySelectorAll('p')) {}
Why have the overhead of a callback to begin with. It reads SO much better as well.
- gliese1337 10y agoIt has different semantics. Your code is equivalent to a `forEach` call, not `map`. Calling `map` returns a new array containing the results of the callback, while a for loop or a `forEach` don't.