micro-projects

Always be learning

View the Project on GitHub

Fun One

Teach someone what this function does, and how it works:

function fun1(){
    var result = [];
    for (var i = 0; i < 5; i++){
        result.push( function() {return i} );
    }
    return result;
}

console.log(fun1()[0]()) 

Find an explanation on this StackOverflow question.