Interactive interpreter variables

suggest change

These names are console helpers in browser developer tools. They are not part of the JavaScript language, and they are absent in Node.

$_ is the value of the last evaluated expression.

"foo"             // "foo"
$_                // "foo"

$0 refers to the DOM element currently selected in the Inspector. So if <div id="foo"> is highlighted:

$0                      // <div id="foo">
$0.getAttribute('id')   // "foo"

$1 refers to the element previously selected, $2 to the one selected before that, and so forth for $3 and $4.

$$(selector) is a shortcut for document.querySelectorAll. In Chrome it returns an array, not a NodeList.

var images = $$('img');

In the Chrome console, $ is document.querySelector, not document.getElementById.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents