JavaScript If Statements

up:: JavaScript

If Statements

if (condition){
codeblock
}
  • comparing to values: ==
    • normally, js coerces one type to another: '1' == 1 is true (string to number)
  • type match: ===
    • typeof shows the type
  • not equal: !=
  • logical and &&
  • logical or ||