JavaScript Loops Worksheet

Questions

Question 1

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

for loops include a counter variable and while loops only excute if the booleen expression is true!

Question 2

What is an iteration?

When a loop keeps repeating itself.

Question 3

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

an element that is processed through the body of the loop.

Question 4

What is a 'counter variable'?

a counter variable is a name that's value is set to 1.

Question 5

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

stops the loop after an iteration.

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.