Review Part 1
html / Javascript
No html on exam.
Variables
--Types
int, string,
--Operations
int + string = string
12 + "Guzy" = "12Guzy"
12 + "2" = "122"
38 + "1" + 7 = 3817
12 + 5 + "9" = 179
"3" + 1 + 99 = 3199
"3" + (1 + 99) = 3100
Conditionals
--Boolean Math
Boolean Operators
AND
both inputs T --> result is T
Example
T && T = T
T && F = F
F && F = F
OR
Either is T, then result is T
Example
T || F = T
!!!(F && T || !F) || T
= T
NOT
Opposite
!T = F
!F = T
Example
!(T || F && !F && T)
!(T)
= F
--If statements
mx = 100
my = 350
screen = 2
day = "Saturday"
if(mx > 400 && my < 200 && screen == 2 && day != 'Tuesday')
Solution
if(F && F && T && T)
--> does not run
if( cond1 )
else if ( cond2 )
else if ( cond3 )
else
First condition to come up T, breaks the if statement. Will not check any further conditions.
cond1 = T
cond2 = F
cond3 = F
if(cond1){
if(cond3){
alert("Whoop!");
}else{
alert("There");
}
}else if (cond2){
alert("it");
}else{
alert("is.");
}