Font size
WorksheetsMoringa JavaScript Iteration
Total questions: 10
Worksheet time: 8mins
Loops offer a quick and easy way to do something repeatedly.
FALSE
TRUE
The code below repeats the log 5 times.
for (let i = 0; i < (a) ; i++) { console.log(i); }
The following code repeats the code 5 times;
let i = 0;
do { i += 1; console.log(i); } while (i < 5);
What would be the first log value?
1
0
The following code repeats the log 5 times.
let i = 0; while (i < 5) { console.log(i); i++; }
What is the first logged value?
1
0
A (a) statement is used to terminate execution is a for loop, while loop, do-while loop & switch statement.
A (a) statement is used to restart a while, do-while, and for loop.
Is the following statement true?
for in loops over enumerable property names of an object, while for of uses an object-specific iterator and loops over the values generated.
YES
NO
(a) is the act of a function calling itself and is used to solve problems that contain smaller sub-problems.
Which of the following statements is true about recursion?
Recursion has more overhead in terms of memory.
Recursion can reduce time complexity.
Recursion is better at tree traversal.
A (a) function can pause midway and then continues from where it paused.
