Which loop in JavaScript allows code to be executed repeatedly as long as a specified condition is true?
Which loop in JavaScript is guaranteed to execute the code block at least once?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
What is the purpose of the break statement in JavaScript loops?
What is the purpose of the continue statement in JavaScript loops?
What will be the output of the following code?
for (let i = 0; i < 5; i++) {
if (i === 3) {
continue;
}
console.log(i);
}
What will be the output of the following code?
let i = 0;
while (i < 5) {
console.log(i);
i += 2;
}
What will be the output of the following code?
let i = 0;
do {
console.log(i);
i++;
} while (i < 3);
What will be the output of the following code?
let x = 5;
for (let i = 0; i < x; i++) {
if (i === 3) {
break;
}
console.log(i);
}
What will be the output of the following code?
let x = 3;
for (let i = 0; i < x; i++) {
console.log(i);
x++;
}
What will be the output of the following code?
let x = 0;
switch (x) {
case 0:
console.log("Zero");
break;
case 1:
console.log("One");
break;
default:
console.log("Default");
break;
}
What will be the output of the following code?
let x = 2;
switch (x) {
case 0:
console.log("Zero");
break;
case 1:
console.log("One");
break;
default:
console.log("Default");
break;
}
Which loop statement is most appropriate when the number of iterations is known in advance?
Which loop statement is most appropriate when the condition for termination is checked at the end of the loop?
What happens if the update expression is omitted in a for loop?
51 videos|28 docs|12 tests
|
51 videos|28 docs|12 tests
|