Statements Flashcards
1
Q
If () {
}
A
If the logic expression is true, only then will the statements be executed
2
Q
If () {
} else {
}
A
If the logic expression is true, only then will the first statements be executed, if false, then the second set will be executed
3
Q
If () {
} else if () {
} else {
}
A
If the logic expression is true, only then will the statements be executed
4
Q
Switch
A
Switch a pre defined value for another when requested
function day_of_week_(day) { switch(day){ case 1: return “Monday”; case 2: return “Tuesday”; }}
day_of_week(1)
“Monday”
5
Q
While
A
var i= 1; while (i<=10){ console.log(i); i++; }
6
Q
for
A
for(var i =0; i <=100; i++) { console.log(i); }
7
Q
break
A
for(var i =0; i <=100; i++) { if (i==6){break;} console.log(i); }
Will stop at 7
8
Q
Continue
A
for(var i =0; i <=100; i++) { if (i ==8){ continue;} console.log(i); }
8 will not be shown