“querySelectorAll()” with multiple conditions in JavaScript

Is it possible to make a search by querySelectorAll using multiple unrelated conditions? Yes, because querySelectorAll accepts full CSS selectors, and CSS has the concept of selector groups, which lets you specify more than one unrelated selector. For instance: var list = document.querySelectorAll(“form, p, legend”); …will return a list containing any element that is a … Read more

Precedence: Logical or vs. Ternary operator

Yes, the || operator has higher precedence than the conditional ?: operator. This means that it is executed first. From the page you link: Operator precedence determines the order in which operators are evaluated. Operators with higher precedence are evaluated first. Let’s have a look at all the operations here: step = step || (start … Read more

How is the nullish coalescing operator (??) different from the logical OR operator (||) in ECMAScript?

The || operator evaluates to the right-hand side if and only if the left-hand side is a falsy value. The ?? operator (null coalescing) evaluates to the right-hand side if and only if the left-hand side is either null or undefined. false, 0, NaN, “” (empty string) are for example considered falsy, but maybe you … Read more