Comparisons Flashcards
1
Q
Alert true, when x is greater than y.
x = 10; y = 5;
A
alert(x > y);
2
Q
alert true, when x is equal to y.
x = 10; y = 10;
A
alert(x == y);
3
Q
alert true, when x is NOT equal to y.
x = 10; y = 5;
A
alert(x != y);
4
Q
create a var named ageCategory. If age given is less than 18 assign “Minor” otherwise assign “Adult”.
var age = n;
A
var ageCategory = (age < 18) ? “Minor” : “Adult”;