Re:How I discovered my love for JavaScript after throwing 90...
by fenomas on Sunday September 17, 2017 @10:00PM
(#15272852)
This isn't a concern unless you're tuning performance and the loop is a bottleneck. forEach can be slower (if the JS engine doesn't inline the function body), but not to the extent that you need to structure your code around it.
[ Parent
| on HN ]
Re:How I discovered my love for JavaScript after throwing 90...
by satori99 on Sunday September 17, 2017 @10:05PM
(#15272869)
Yeah, I agree with that. Which is why I mentioned performance sensitive stuff like WebGL.
Personally I use the functional methods whenever I can, but the original quote I re-posted indicates that the author thinks that for-loops should always be replaced with their functional equivalents, and I was just pointing out that this is not universally a good idea yet.
Re:How I discovered my love for JavaScript after throwing 90...
by fenomas on Sunday September 17, 2017 @11:06PM
(#15273108)
Yeah, I agree - just adding a caveat to your caveat.
Personally I found the whole article very skippable. None of it is necessarily terrible advice, but everything is overstated, and said without really explaining why its advice better than the alternatives.