Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,931 questions

51,867 answers

573 users

How to use while statement in JavaScript

2 Answers

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

/*
run:
 
0
1
2
3
4
5
6
7
8
9
 
*/

 



answered May 1, 2017 by avibootz
0 votes
var i = 10;
while (i > 0) {
    document.write(i + "<br />"); 
    i--;
}

/*
run:
 
10
9
8
7
6
5
4
3
2
1
 
*/

 



answered May 2, 2017 by avibootz

Related questions

1 answer 140 views
2 answers 251 views
1 answer 123 views
1 answer 192 views
2 answers 220 views
220 views asked Jun 14, 2016 by avibootz
1 answer 205 views
1 answer 216 views
...