r/javascript • • Mar 18 '19

What's your favorite, most useful javascript one-liner?

385 Upvotes

422 comments sorted by

View all comments

Show parent comments

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.

3

u/[deleted] Mar 19 '19

Dev-tools is the context of the conversation

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();