JavaScript Loops Worksheet

Questions

Question 1

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

the variable is created and iterated in the for loop

Question 2

What is an iteration?

a loop

Question 3

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

it is the action that is happening in each step of the loop

Question 4

What is a 'counter variable'?

the variable that is changed with the iterator

Question 5

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

stops the loop and goes to the next line of code after the loop block

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.