Please Explain this. Confused me. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please Explain this. Confused me.

var arr =[1,2,3,4]; var ct = arr.length; for( var i=0;i<ct;i++){ ct--; arr[i]+=i; } document.write(arr);//1,3,3,4

5th May 2020, 4:56 AM
Md Iftakher Hossain
Md Iftakher Hossain - avatar
1 Answer
+ 1
I think the loop runs two times.
5th May 2020, 6:24 AM
Kashyap Kumar
Kashyap Kumar - avatar