Hello, would someone kindly explain why this code doesn't display anything? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Hello, would someone kindly explain why this code doesn't display anything?

var x = 0; while(x<10){ document.write(x + "<br>"); x+2; }

25th May 2020, 4:54 PM
Volca-Nick Mukuha
Volca-Nick Mukuha - avatar
3 Antworten
+ 5
You should do increment so you need to write x=x+2 rather then x+2 Ok
25th May 2020, 5:06 PM
Ayush Kumar
Ayush Kumar - avatar
+ 2
It should x+=2 not x+2
25th May 2020, 5:08 PM
Ore
Ore - avatar
+ 1
learn about operators. assignment, arihmetic, logical relational. what youve written is an arihmetic operator, while you want an assignment operator.
25th May 2020, 8:20 PM
Logomonic Learning
Logomonic Learning - avatar