|
1 | 1 | **Table of Content**
|
2 | 2 |
|
| 3 | +- [Loops and Iteration](#loops-and-iteration) |
| 4 | + - [`while` Loops](#while-loops) |
| 5 | + - [`do-while` loop](#do-while-loop) |
| 6 | + - [`for` loops](#for-loops) |
| 7 | + - [`for...of` loop](#forof-loop) |
| 8 | + - [`for...in` loop](#forin-loop) |
| 9 | + - [Controlling Loops](#controlling-loops) |
| 10 | + |
3 | 11 | # Loops and Iteration
|
4 | 12 |
|
5 | 13 | We regularly face conditions when we need to run our code over and over again until some condition is met. JavaScript provides us several forms to achive this condition.
|
@@ -84,7 +92,7 @@ Steps involved:
|
84 | 92 | 5. Go back to Step 2.
|
85 | 93 | 6. Output the results.
|
86 | 94 |
|
87 | | -## for...of loop |
| 95 | +## `for...of` loop |
88 | 96 |
|
89 | 97 | We can use `for...of` statement to loop over an iterable object such as Array, String, Map, Set etc.
|
90 | 98 |
|
@@ -138,7 +146,7 @@ for (const num in vars) {
|
138 | 146 | */
|
139 | 147 | ```
|
140 | 148 |
|
141 | | -**Controlling Loops** |
| 149 | +## Controlling Loops |
142 | 150 |
|
143 | 151 | We can have more control over loops with the keywords `continue` and `break` provided by JavaScript.
|
144 | 152 |
|
@@ -179,7 +187,3 @@ for (let i = 0; i < even.length; i += 1) {
|
179 | 187 |
|
180 | 188 | console.log(indexOfSix);
|
181 | 189 | ```
|
182 | | - |
183 | | -``` |
184 | | - |
185 | | -``` |
|
0 commit comments