0

I need explanation pls, why does x= 1 ? var x=1; var y=4; function func(){ while (y>0){x++; y--;} }document. write(x);

Javascript challenge question

3rd Jun 2020, 10:51 AM
Silva Olushola Fredrick
Silva Olushola Fredrick - avatar
6 Réponses
+ 2
u dont call the function
3rd Jun 2020, 10:58 AM
durian
durian - avatar
+ 15
Please show your full code.
3rd Jun 2020, 10:53 AM
NightFox
+ 14
Lily Mea yes you're right... Bcoz Ema you don't call the function.
3rd Jun 2020, 11:13 AM
NightFox
+ 1
Lily Mea you're right....Thanks
3rd Jun 2020, 11:11 AM
Silva Olushola Fredrick
Silva Olushola Fredrick - avatar
0
Dev I just edited it properly to show the full code...
3rd Jun 2020, 10:58 AM
Silva Olushola Fredrick
Silva Olushola Fredrick - avatar
0
This is the code below.. I want to know why x=1 var x=1; var y=4; function func() { while (y>0){ x++; y--; } } document. write(x);
3rd Jun 2020, 11:03 AM
Silva Olushola Fredrick
Silva Olushola Fredrick - avatar