Logical Short Circuiting
Video
JavaScript Notes
JavaScript
// short-circuit.js
// How to use short circuiting in JS
// FALSEY – 0, false, null, undefined, "", '', NaN
let log = console.log;
let obj = {prop: 42, bool: true};
let num - 42;
let f = ( ) => { return num };
let g = ( ) => { log(42) };
(1 && 1 && 1 && 1 && 0); // use 0s or FALSEY values for short-circuiting
{1 && 1};
Feedback
Submit and view feedback