JavaScript Loops Worksheet

Questions

Question 1

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

while loops are just a boolean expretion and while it is true it will cotinue the Loop. for loops are self contaned in the peramiters so you set a counter var and a boolean and an incrementer. and it will increment the counter untill the boolean is not true.

Question 2

What is an iteration?

an iterate is one cycle of a loop.

Question 3

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

it is the specific item that the loop is focused on at any given time.

Question 4

What is a 'counter variable'?

it is the var that you set specificly to be used as a counter for a for loop.

Question 5

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

it just ends the loop without having a proper conclusion.

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.