Last Class Review

Variables

  • declaring variables using var keyword

  • assigning / reassigning variables

// declaring a variable

var firstName;


// assigning a value to the variable

firstName = "Cletus";

// declare and assign an intial value to a variable

var score = 0;


// declare and assign a value of 0 to the score variable
var score = 0;

// changing the value of the score variable from 0 to 3
score = 3;


Data types

  • Strings

  • Numbers

  • Booleans

  • Arrays

  • Objects


Operators

  • Arithmetic

  • Comparison

  • Logical


Conditionals

  • (if else) statements

var brushedTeeth = false

if(brushedTeeth){

  alert('Great job, you brushed your teeth!');

} else {

  alert('Go your brush teeth man, your breath is hot right now!');
}

  • (if else if) statements

var yourGrade = 84;

if (yourGrade >= 90) {

  alert("Congrats your score is 90 or above, that's an A!");

} else if (yourGrade >= 80){

  alert("Congrats your score is 80 or above, you earned a B");

} else {

  alert("Your score is less than 80, no bueno");
}