Prework Qs for 101 Intro To Web


I. Egghead
Video 4
Are these videos supposed to compare React.JS and JQuery? (e.g. $() vs. $$() )… and what are we supposed to have gathered from that?


Great question!

These videos are merely meant to show you some of the powerful features available in the Chrome DevTools.

The $() functionality in the console is provided specifically by Chrome to interact with the DOM you’re currently inspecting, and with a jQuery-esque syntactical signature that’s intended to be super familiar to almost all JavaScript developers.

The semantics of the different $ options are designed to act as jQuery-like operations - it’s quite natural for most JS developers to just write $('.kittens') and expect all elements with the class kittens to be selected. However, in the DevTools, we only get one element - $$('.kittens') is what will actually return all those elements.

The rationale behind the $1, $2, $3, etc., however, doesn’t draw from jQuery, but in fact from bash programming, specifically positional parameters. You can learn more about them here - it’s a pretty interesting feature of the bash scripting environment.