DEV Community

Discussion on: Better console.logs

Collapse
 
miku86 profile image
miku86 • Edited

Related to console.log in the Dev Tools,

we can use $ instead of document.querySelector
and $$ instead of document.querySelectorAll.

That's not related to the jQuery $.

Example:

// old
document.querySelectorAll(".myClass");

// new
$$(".myClass");
Enter fullscreen mode Exit fullscreen mode
Collapse
 
wangonya profile image
Kelvin Wangonya

Wow, didn't know that. Thanks!

Collapse
 
c24w profile image
Chris Watson

Also, $0 to get the element you've got selected in the inspector (in Chrome).