looping used forloop in javascript | Sololearn: Learn to code for FREE!

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

4/27/2018 4:17:05 PM

Hafizd Jubaidir

1 Answer

New Answer

+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