ELSE IF Statements
Video
JavaScript Notes
JavaScript
var first_name = "Ricky";
var last_name = "Bobby";
var age = 45;
var first = true;
var last = false;
var bob; //undefined
//Falsey
//false, null, undefined, 0, “”, ‘’, NaN
If( age <= 40 ){
// if the value of age is less than or equal to 40
} else if ( (age > 40) && (age < 50) ){
// if age is greater than 40
// && - means AND
// || - means OR
} else if ( age < 0) {
// otherwise prevent something from happening
} else {
// greater than 50
}
// COMPARISON OPERATORS
// < <= > >= == != ! === (are the same object, not just the same value)
Feedback
Submit and view feedback