0
Why given bellow code give the answer 60 ?
var x=10; x*=2; while(x<30){ x+=5; x=y; } alert(y+x);
5 Réponses
+ 6
x*=2; #x=20
while(x<30){
x+=5;
x=y;
}
After first itteration: x = y = 25
After second: x=y=30
alert(y+x); #30+30=60
+ 1
In the while you mentioned x = y, so y and x are the same value in the end of the while cycle. Y automatically becomes 30. Every time in this cycle y becomes similar to x
0
What is y in this code? What is it's initial value?
- 2
10-20-30-0
- 2
i dont no🤷♂️