Chrome, Safari and Opera now support querySelectorAll().forEach() 
-
-
Replying to @bdc
Why would you want to use `forEach`, though? This allows `break`: for (const element of document.querySelectorAll(selector)) { … }
4 replies 0 retweets 2 likes -
when would a break be appropriate or desirable? Is the returned entity dynamic?
1 reply 0 retweets 0 likes -
Replying to @barneycarroll
`qSA` returns a non-live `NodeList`. `break` is useful if you can stop processing the elements mid-loop. +
@bdc1 reply 0 retweets 0 likes -
find is good for that (although maybe not as initially intuitive). Array iterator methods' commitment to intent can be a boon…
2 replies 0 retweets 0 likes
Replying to @barneycarroll @bdc
Note that `break` was just an example. There’s also `continue`. `for-of` offers more flexibility than `forEach`.
4:47 AM - 8 Jun 2016
0 replies
0 retweets
1 like
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.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.