Conditions Flashcards
1
Q
alert “Hello World” if x is greater than y.
A
if (x > y) {
alert(“Hello World”);
}
2
Q
alert “Hi” if x is greater than y, otherwise alert “Bye”.
A
if (x > y) { alert("Hi"); } else { alert("Bye"); }
alert “Hello World” if x is greater than y.
if (x > y) {
alert(“Hello World”);
}
alert “Hi” if x is greater than y, otherwise alert “Bye”.
if (x > y) { alert("Hi"); } else { alert("Bye"); }