Closure with parameter in Javascript
<p>It is a simple question, why are var1 and var2 undefined .</p>

<p>I was trying to learn closures in javascript and added a parameter but not sure why it is undefined.</p>

<pre><code>    var closureFunction = function(var1,var2){  
        var privateVar = var1+var2;     

        console.log("Sum of "+ var1 +" and "+ var2+"");     
        return function(){return privateVar;} 
    }();


    console.log(closureFunction(2,3));
</code></pre>