JavaScript Loops Worksheet

Questions

Question 1

What is the difference between a while loop and a for loop?

While loops are good for continues based on a condition, for loops are good for a sequence or a range.

Question 2

What is an iteration?

Iteration is repeating a set of instructions in a loop.

Question 3

What is the meaning of the current element in a loop?

The current element is the specific value of the element in the current iteration of the loop.

Question 4

What is a 'counter variable'?

A counter variable is used to keep track of how many times the loop has been invoked and the scaling of the numarical value of the loop.

Question 5

What does the break; statement do when used inside a loop?

A break is a condition that a loop uses to end the loop before a differnect condition is met.

Coding Problems

Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.

Always test your work! Check the console log to make sure there are no errors.