0
Why answer 0 ,why not 4.
var x = [9,5,4]; for( var i=1; i < 3 ; i++){ x[0]%=x[i]; } console.log(x[0]);
6 Réponses
+ 4
At i = 1,
9 %= 5
so x[0] becomes 4
At i = 2,
4 %= 4
so x[0] becomes 0
To understand these quiz, you can add console.log to the code block to check the state changes in each iteration, like this :
https://code.sololearn.com/W7DS6On5Ut6c/?ref=app
+ 3
ChaoticDawg nice attempt, yet note that the for loop starts from 1 instead of 0.
+ 3
Gordon whoops nice catch, totally missed that thanks
edit: deleted answer, I'm blaming sleepy eyes. lol
+ 1
ChaoticDawg no problem ;-)
+ 1
Thanks all.
I calculated for i=1,
Than stop. What a fool am I??
+ 1
Md. Iftakher Hossain you'll get better and better :)
try some projects