Please Explain this. Confused me. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 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 Respuesta
+ 1
I think the loop runs two times.
5th May 2020, 6:24 AM
Kashyap Kumar
Kashyap Kumar - avatar