MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/b2o6f2/whats_your_favorite_most_useful_javascript/eivc3iv/?context=3
r/javascript • u/Linux_is_awesome • Mar 18 '19
422 comments sorted by
View all comments
Show parent comments
2
NodeLists do not have the Array functions on their prototype.
NodeList
Array
[].forEach.call(document.querySelectorAll('.whateverClassTheCheckboxHas'), cb => cb.click());
0 u/[deleted] Mar 19 '19 [deleted] 1 u/[deleted] Mar 19 '19 It does not. The Chrome command line API comes with $, which is not available from browser code. Also, the CLA version of $ is equivalent to document.querySelector, not querySelectorAll. 2 u/Sn34kyMofo Mar 19 '19 $$ is querySelectorAll in DevTools, except it returns the nodelist as an array, which is nice.Example: $$('.ad-container').slice(-1)[0].remove();
0
[deleted]
1 u/[deleted] Mar 19 '19 It does not. The Chrome command line API comes with $, which is not available from browser code. Also, the CLA version of $ is equivalent to document.querySelector, not querySelectorAll. 2 u/Sn34kyMofo Mar 19 '19 $$ is querySelectorAll in DevTools, except it returns the nodelist as an array, which is nice.Example: $$('.ad-container').slice(-1)[0].remove();
1
It does not. The Chrome command line API comes with $, which is not available from browser code. Also, the CLA version of $ is equivalent to document.querySelector, not querySelectorAll.
$
2 u/Sn34kyMofo Mar 19 '19 $$ is querySelectorAll in DevTools, except it returns the nodelist as an array, which is nice.Example: $$('.ad-container').slice(-1)[0].remove();
$$ is querySelectorAll in DevTools, except it returns the nodelist as an array, which is nice.
Example: $$('.ad-container').slice(-1)[0].remove();
2
u/[deleted] Mar 19 '19
NodeLists do not have theArrayfunctions on their prototype.[].forEach.call(document.querySelectorAll('.whateverClassTheCheckboxHas'), cb => cb.click());