Please advice

/* I wish to understand this code? Why it returns the value 10?*/

for(var i = 0; i<10; i++)

{

console.log(i)

}

console.log(i);

Hello @pallavichhajed336781, welcome to the forums! Since the last value of i is 10, the line here:

prints out the last value assigned to i-10.

1 Like