0

Please help with increment. In increment it always add one number buy why in the loop adding 2 number

var i=1 for(k=1; k<=10; k++) { document.write(k+=i, "</br>"); }

8th May 2020, 12:18 PM
Dev Sharma
Dev Sharma - avatar
2 Réponses
0
'k' itself is incremented after each iteration and to that you are adding 1 so it will be incremented by 2 in total.
8th May 2020, 12:32 PM
Avinesh
Avinesh - avatar
0
Thanks
8th May 2020, 2:19 PM
Dev Sharma
Dev Sharma - avatar