var temp = [] for(var i = 0; i < 5; i++) { temp.push(function(){return i}) } console.log(temp[1]()) console.log(temp[2]()) console.log(temp[3]()) console.log(temp);