Okay, somebody explain to me the rationale for this ESLint rule https://github.com/github/eslint-plugin-github/blob/master/docs/rules/array-foreach.md …
-
Show this thread
-
-
Replying to @codahighland @qntm
forEach involves constructing and tearing down a stack frame for every iteration and it has minimal ability to interrupt the iteration prematurely (have to throw an exception), and it only gives access to local variables via closure.
1 reply 0 retweets 1 like -
Replying to @codahighland @qntm
for..of works like a loop construct is EXPECTED to work -- you can break, you can continue, you can return from the middle of it -- and it works entirely in the local scope. Depending on implementation this is 1-2 orders of magnitude faster.
1 reply 0 retweets 1 like -
Replying to @codahighland @qntm
For...of also looks cleaner, which js desperately needs.
1 reply 0 retweets 0 likes
Consider `http://arr.map (f).filter(g).forEach(h)` vs. `for (x of http://arr.map (f).filter(g)) { h(x) }`
-
-
Replying to @qntm @codahighland
Yea, both are hideous. Admittedly the forEach is cleaner here, but js is still madness.
1 reply 0 retweets 0 likes - 3 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.