0

looping used forloop in javascript

anyone can explain why the result 17?, please explain to me, I am still confused with the looping. https://code.sololearn.com/W695XUwGItIM/?ref=app

27th Apr 2018, 4:17 PM
Hafizd Jubaidir
Hafizd Jubaidir - avatar
1 Odpowiedź
+ 1
let result = 0; for(let i = 0; i < 5; i++){ if(i == 3){ result += 10; }else{ result += i; } } document.write(result); 1+2+10+4=17
27th Apr 2018, 4:18 PM
᠌᠌Code X
᠌᠌Code X - avatar