0

How make a loop return even numbers?

Hello guys, I'm trying to make this loop return even numbers but it's giving me an error message on line 1 for (i=2; i<=10; i++2) { document.write(i + "<br />"); }

3rd Dec 2016, 5:09 PM
Jehonadab Okpukoro
Jehonadab Okpukoro - avatar
3 Antworten
+ 3
you are writing i++2 change it to i=i+2 or I+=2
3rd Dec 2016, 5:14 PM
Vinay Mahore
Vinay Mahore - avatar
0
Thanks..
3rd Dec 2016, 5:15 PM
Jehonadab Okpukoro
Jehonadab Okpukoro - avatar
0
i++ equals to i=i+1 so you can't use this shortcut in this case
13th Dec 2016, 7:01 PM
Marek Kaczycki
Marek Kaczycki - avatar