Nailing the Basics
var x = 5
And check it was defined by typing
x
and you should see the value of x printed
if(true){
// run true code
} else {
// run false code
}
Here is an example on our 'x' variable from before
if(x > 5){
alert('X was larger than 5');
} else {
alert('X was less than or equal to 5');
}
if(x > 3){
if(x < 6){
alert('x was greater than 3 and less than 6');
}
}
with Boolean Logic
if(x > 3 && x < 6){
alert('x was greater than 3 and less than 6');
}
if(!(x > 4)){
alert('x is not greater than four (x is less than or equal to 4)');
}