Basic 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(last){
// won’t run, as last = false
}
If(age){
// will run as age does not = 0
}
if( age == 45 ){
// do something if true
} else {
// do something if false
}
Feedback
Submit and view feedback