Thanks to everybody responding "JavaScript is complete garbage", that's extremely helpful in context
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Trying to find rationale in Javascript conventions is a gateway to madness.
-
Thanks for your input!
End of conversation
New conversation -
-
-
Is it because of the note on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach … talking about how the .forEach() loop can't be broken without an exception? (am not a full-time ES person)
-
I doubt it because if you needed to break the loop then you can't have used `Array.prototype.forEach` in the first place
End of conversation
New conversation -
-
-
outside of javascript, the general topic to look up is "internal vs external iterators"
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
1. for-of works on anything with an iterator, a superset of things that forEach works on 2. `this`-rebinding is extra cognitive overhead, common source of bugs 3. can break/continue/return 4. (completely speculative, run your own benchmarks) maybe faster???
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Maybe it's to do with syntactical considerations - you don't need to wrap a lambda in a function call when using `for ... in`. But I've never done any substantial amount of JS, so don't know if it's significant.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I think stuff like this is generally a style concern… but if I had to guess I’d say that it has to do with lack of break/continue + the possible rebinding of this. I think `forEach` can also be less performant in certain cases.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
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.