Interactive interpreter variables

suggest change

Note that these only work in the developer tools of certain browsers.

$_ gives you the value of whatever expression was evaluated last.

"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.

To get a collection of elements matching a CSS selector, use $$(selector). This is essentially a shortcut for document.querySelectorAll.

var images = $$('img');  // Returns an array or a nodelist of all matching elements

ยน alias to either document.getElementById or document.querySelector

Feedback about page:

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


Debugging:
* Interactive interpreter variables

Table Of Contents
11 Arrays
12 Objects
14 Classes
16 Map
17 Set
24 Loops
27 Date
29 Scope
30 AJAX
35 Cookies
41 JSON
44 Fetch
45 Modules
46 Screen
51 Debugging
64 Console
68 Symbols
73 Modals
76 Events
86 Proxy
89 WeakMap
90 WeakSet
102 Tilde