![While loop javascript](https://cdn2.cdnme.se/5447227/9-3/5_64e61dfa9606ee7f6350b87c.png)
![while loop javascript while loop javascript](https://i.ytimg.com/vi/GgAyEcbxUFo/hqdefault.jpg)
![while loop javascript while loop javascript](http://javawithumer.com/wp-content/uploads/2018/08/Screenshot287429.png)
The loop will keep on iterating until this condition. Khan Academy is a nonprofit with the mission of providing a free, world-class education for anyone, anywhere. The while loop statement takes a single argument which is the condition for the termination of the loop. In the example below we will add all even numbers from 0 to 10 and display the output. Learn for free about math, art, computer programming, economics, physics, chemistry, biology, medicine, finance, history, and more. The JavaScript While Loop is used to repeat a block of statements for a given number of times until the given condition is False. The while statement creates a loop that executes a specified statement as long as the test condition evaluates to true. For example, to skip one iteration use j = j + 2. In Javascript, a while loop is a control flow statement that allows code to be run repeatedly based on the given condition.
![while loop javascript while loop javascript](https://codebrainer.azureedge.net/images/loops-in-js-do-while-loop.jpg)
The increment value is an expression such as i++ or j++ which expands to i = i +1 or j = j+1 therefore, by default we use 1 value to increment, but depending on the script we can increase it. Write, Run & Share Javascript code online using OneCompilers JS online compiler for free. A while loop consists of a condition(s) and as long as that condition(s) is true, the set of statements inside the while block is executed repeatedly. The result of test operation is always boolean – True or False.
![While loop javascript](https://cdn2.cdnme.se/5447227/9-3/5_64e61dfa9606ee7f6350b87c.png)