Conditions in JavaScript

Conditions in JavaScript: Making Decisions with if and else, Combining Conditions with And, Or and Not, switch and the Conditional Operator.

Updated

  1. Making Decisions with if and else (Novice): An if statement runs a block of code only when its condition is true, else gives the other path, and else if chooses between several, so your program can react to what's going on.
  2. Combining Conditions with And, Or and Not (Apprentice): The logical operators && (and), || (or) and ! (not) join small true-or-false checks into one condition, so a single if can follow a real rule with several parts.
  3. switch and the Conditional Operator (Apprentice): A switch statement matches one value against a list of exact choices, and the conditional operator ? : picks one of two values in a single line, so a long chain of else ifs can say what it means.