'use strict';
let printNumTwo;
for (let i = 0; i < 3; i++) {
if (i === 2) {
printNumTwo = function() {
return i;
};
}
}
And this statement is there below above code.
strong text
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.
my question is are there three different i variables or just one which is assigned three different number i.e 0,1 and 2 one after another ???
I think only one variable i is created , right??
i do not know i might be interpreting the classroom statement incorrectly, say so if that is the case!
Thanks.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords