Conditionals

  • Normal JavaScript runs line-by-line
  • Conditionals allow you to make a decision
  • Run one code block or another
if (someNumber < 123) {
    // Do a thing
} else if (something > 200) {
    // Do something else
} else {
    // Do something else
}

const a = 123;
if (a) {
    // Do a thing
}

14 / 21