I can't figure out why the code will not work? How do you put two or more commands in a while loop for Javascript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I can't figure out why the code will not work? How do you put two or more commands in a while loop for Javascript?

https://code.sololearn.com/WM9huZh3r6ag/?ref=app

31st Mar 2022, 7:21 PM
Loganmobkiller1 !?!?!
5 Answers
+ 3
you do y+1 in document.write, but that doesn't change y. To increase y, you could do: y = y+1; Or y++; After document.write
31st Mar 2022, 7:34 PM
Lisa
Lisa - avatar
+ 2
And remove the break tag in the loop – it gives an error
31st Mar 2022, 7:31 PM
Lisa
Lisa - avatar
+ 1
You need to increase y on each iteration so that y < x will eventually become false
31st Mar 2022, 7:28 PM
Lisa
Lisa - avatar
+ 1
Lisa thanks I forgot that <br> in Javascript thx
31st Mar 2022, 7:33 PM
Loganmobkiller1 !?!?!
+ 1
Lisa thank you, that has very helpful
31st Mar 2022, 8:37 PM
Loganmobkiller1 !?!?!