JavaScript is scary. I lost two client because "false" is true in js.

  • 4
    Things are "truthy" and "falsy" in JS. Null, undefined, 0, and false are all "falsy" things. Defined things, true, literally any number not 0, are all "truthy" things.

    let q = null;
    if (!q) console.log('hi')
    /// ^ Truthy checking
  • 1
    @jschmold yup. The issue made me look more on this subject.
Your Job Suck?
Get a Better Job
Add Comment