0

Why does result equal 1?

var a=[9,5,3]; for (i=1;i<3;i++){ a[0]%=a[i] } document.write(a[0]);

23rd Dec 2017, 2:24 AM
Luke
Luke - avatar
2 Antworten
+ 7
9 %=5 //a[0]%=a[1] now a[0] is equal to 4.then, 4%=3 //a[0]%=a[2] now a[0] is equal to 1. well hope you understand
23rd Dec 2017, 2:50 AM
Leon lit
Leon lit - avatar
+ 1
I got it. thanks
23rd Dec 2017, 4:39 AM
Luke
Luke - avatar