further explanation (#27620)
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
title: Iterate with JavaScript While Loops
 | 
					title: Iterate with JavaScript While Loops
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
Another type of JavaScript loop is called a `while loop` because it runs `while` something is true, and stops once that something is no longer true.
 | 
					Another type of JavaScript loop is called a `while loop` because it runs `while` something is true, and stops once that something is no longer true. Unlike the `for loop`, which is made up of three parts, the `while loop` only contains a condition statement.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var ourArray = [];
 | 
					    var ourArray = [];
 | 
				
			||||||
    var i = 0;
 | 
					    var i = 0;
 | 
				
			||||||
@@ -9,3 +9,5 @@ Another type of JavaScript loop is called a `while loop` because it runs `while`
 | 
				
			|||||||
      ourArray.push(i);
 | 
					      ourArray.push(i);
 | 
				
			||||||
      i++;
 | 
					      i++;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 It is important to remember to increase the variable used in this example, without the addition of `i++` the loop would continue forver.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user