While Loops

  • While loops run as long as something is "truthy"
let counter = 0;
while(counter < 5) {
    console.log(counter);
    counter ++;
}

let test = "blahh"
while(test) {
    // Runs forever
}

8 / 24