डाउनलोड पी.डी.एफ. ई-बुक्स
JS - While Loop

Loop एक विशिष्ट number तक Statements को execute करता है |

While Loop

while Loop जब तक condition true होती है तब तक statements को बार-बार executes करता रहता है और जब condition false हो जाती तब execution stop हो जाता है |

Syntax for While Loop

while(condition){
	//while Statement(s);
}

Example for While Loop

Source Code :
<script type="text/javascript">

var i = 0;
while(i<10){
	document.write("Value of i is " + i + "<br />");
	i++;
}

</script>
Output :
Value of i is 0
Value of i is 1
Value of i is 2
Value of i is 3
Value of i is 4
Value of i is 5
Value of i is 6
Value of i is 7
Value of i is 8
Value of i is 9