Booleans

Booleans

  • Can only have a value of true or false

  • true/false are special keywords in javascript and do not have quotes around them

// declare a variable called isOn and assign a value of true
let isOn = true;

// declare a variable called isWarm
let isWarm;

// assign a value of false to isWarm
isWarm = false;

  • Booleans are useful for helping our programs make decisions (when used with conditionals, comparison & logical operators)

  • Booleans also helps a program known when it should stop/start looping