4
On any empty page (no library at all), when typing a $
in the browser console is returned a function, as shown in the output below:
ƒ $(selector, [startNode]) { [Command Line API] }
If I type two $
the result is similar:
ƒ $$(selector, [startNode]) { [Command Line API] }
If you type three $
, get error:
Uncaught ReferenceError: $$$ is not defined
I tested in other browsers (IE11, Edge, Firefox) and all return a function, in some cases with slightly different output.
But if I do console.log($)
in a <script>
page, will show the error $ is not defined
:
<html>
<head></head>
<body>
<script>
console.log($);
</script>
</body>
</html>
I wonder exactly what that means $
(single or double) or the function it returns on the console and what would be its application in practice?
Basically it’s a utility for Chrome debugging, if you don’t care about an external source, you can read that
– Andre
@user140828 That’s cool! I didn’t know these console features. Obg! I looked at the page you sent and I’ve already figured out what that means. You can even post an answer :D
– Sam
Note: no FF is the same thing, is not exclusive to Chrome
– Bacco
Variables
$0
,$1
,$2
, etc can also be created by tab it "Elements" to store desired HTML elements. Just a curiosity– Costamilam