Javascript Conditionals

Falsy values in JS

  • false
  • null
  • 0
  • NaN (not a number)
  • ''
  • ""

NOT empty objects or arrays!

Double equals vs triple equals

Triple equals (===) will do the same comparison as double equals (including the special handling for NaN, -0, and +0) but without type conversion; if the types differ, false is returned).

Ternary Operators in JS

const active = true;
var display = active ? 'bold' : 'normal';
console.log(display);

Created from: Modern Javascript Course 202006070113


uid: 202006160016 tags: #javascript #programming


Date
February 22, 2023