Well basically it is looping and i is how many times its looped in simple words. So in your case, i starts at 0 and goes to 3, meaning it will loop 3 times. And you made an if statement inside which is:
if (i === 2) {//do stuff}
It basically just checked that if i is 2 - or that its the second loop, it will run. So when it was the second loop, it console logged 2 by the code you wrote:
printNumTwo = function() {
return i;
};
And then printNumTwo was console logged (printNumTwo was i, or, 2).
I hope that made sense.