Falsy values in Javascript

Falsy values in Javascript

Falsy values are the values evaluated negative in the if condition.

Or exactly defined from ECMA specs, these values are evaluated as false when converted to boolean

Or these value make Boolean function return false when being taken as parameter.

These following values are considered falsy in Javascript. All other values are not.

  • Boolean false: false
  • Zero number: 0
  • Negative zero: 0
  • BigInt zero: 0n
  • null
  • undefined
  • Empty string: ''
  • NaN

Reference: ECMA262.