Look at this code for example:
var arr = [];
var assignFunction = function() {
for (var i = 0; i < 3; i++) {
arr[i] = function() {
console.log(i);
}
}
}
arr[0];
arr[1];
arr[2];
You would expect it will assign a function that you can call/run, but its not. I'm looking for good explanation what its really doing. arr[i] is typeof function, meaning it is being assigned, but will never run and print anything to console.