Create a function and assign its return to a variable
<p>Is there a one line way of doing this? Eg: </p>

<pre><code>var myVare = function(params){
   if(param.condition){
       return 'a';
   }else{ 
       return 'b'; 
   }
}(param:{condition:'abc'}); 

console.log(myVare);//I would like it to be == to 'a'
</code></pre>
