- Tutorials
- JavaScript Tutorial
- JavaScript Loops
JavaScript Loops
8 lessonsAbout 48 minutesBeginner
This part of the JavaScript Tutorial runs from JavaScript for Loop through to JavaScript Nested Loops. There are 8 lessons here, and working through them takes about 48 minutes at a steady pace.
It follows on from JavaScript Conditions, so finish that first if you have not already — the examples below assume you are comfortable with it.
Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.
- 1JavaScript for LoopThe JavaScript for loop is used to run the same block of code again and again.
- 2JavaScript while LoopThe JavaScript while loop is used to repeat a block of code as long as a condition is true.
- 3JavaScript do while LoopThe JavaScript do while loop runs a block of code at least once, then repeats it while a condition is true.
- 4JavaScript break StatementThe JavaScript break statement is used to stop a loop before it normally ends.
- 5JavaScript continue StatementThe JavaScript continue statement is used to skip one turn of a loop and move on to the next one.
- 6JavaScript for in LoopThe JavaScript for in loop is used to loop through the properties of an object.
- 7JavaScript for of LoopThe JavaScript for of loop is used to loop through the values of an array, a string, and other collections.
- 8JavaScript Nested LoopsA JavaScript nested loop is a loop placed inside another loop.
