In Google Chrome's developer tools, when I select an element, I see ==$0
next to the selected element. What does that mean?
This question is related to
google-chrome
google-chrome-devtools
code-inspection
Internally, Chrome maintains a stack, where $0 is the selected element, $1 is the element that was last selected, $2 would be the one that was selected before $1 and so on.
Here are some of its applications:
$0 returns the most recently selected element or JavaScript object, $1 returns the second most recently selected one, and so on.
Refer : Command Line API Reference
I will say It 's just shorthand syntax for get reference of html element during debugging time , normaly these kind of task will perform by these method
document.getElementById , document.getElementsByClassName , document.querySelector
so clicking on an html element and getting a reference variable ($0) in console is a huge time saving during the day
Source: Stackoverflow.com