Let variable inside for loop

printNumTwo() returned the correct value because three different i variables with unique values (0, 1, and 2) were created by the let keyword within the loop statement.

this is from freecodecamp JS DSA course ES6 let /var exercise. I don’t understand how let keyword can create 3 variables, as in for loop execution only the update statement runs from the second time. i gets updated rather than new variables being created everytime right?

Hello! Welcome to the community :wave:t4:!

Could you please share a link to the lesson?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.