could anybody please explain the difference between the following snippets..
var a = function(){
return function(){
//some code
}
}();
and
var a = function(){
//some code
}
I understand we use return function to access variables defined in the parent function and this is a self-executing function but in the first case the first function does nothing but return the other function. I have seen this type of functions a couple of times and am not able to figure out what it is for. Also please explain the above function
var session = (function(){return ${session}})();
and
var session = ${session};