Conditional Operators
-
Used when evaluating conditional expression
-
= = (double equal, not single!)
-
!=
-
<
-
>
-
>=
-
<=
if (cash <= 3.50) {
document.write("Not enough money for a hot dog
at Cinergy");
} else if (cash < 6.00) {
document.write("Not enough money for a coffee
at Starbucks");
} else if (cash == 6.00) {
document.write("Exactly enough for a coffee
at Starbucks!);
} else if (cash <= 15.00) {
document.write("Almost enough money to park
downtown for a day");
} else {
document.write("Dude, you are loaded!");
}
Conditional Expressions
Home
Internet II: Day 2