Javascript if else statement within a Function Expression
<p>I am currently studying Javascript. I tried to download a sample codes where in, there will be a transition of images. Some of the functions have codes I can't fully understand.</p>

<p>the first function is:</p>

<pre><code>function addElementEvent(o,e,f){
    var of = o[e];
    var f2 = function(){of();f();}
    o[e] = !is_function(of) ? f : f2;
}
</code></pre>

<p>I am wondering what is the value of f(). May you please help me></p>

<p>and the second function is this:</p>

<pre><code>var _loadImage = [];
function loadImage(s,f,always_show_loading){
    var i_onload = function(){_loadImage[s]=true;if(f)f(s);}
    var l = function(){if(_loadImage[s]){if(f)f(s);}else{var i=newElement('IMG');i.onload=i_onload;new function(){i.src=s;};}}
    if(always_show_loading) setTimeout(l, typeof(always_show_loading) == 'number' ? always_show_loading : 1000);
    else l();
}
</code></pre>

<p>then this is the LOC I can't fully understand in the second function.</p>

<p>var i_onload = function(){_loadImage[s]=true;if(f)f(s);}</p>

<p>Is that line a shortcut for an if,else statement?</p>

<p>May you please explain the meaning of this code?</p>

<p>Thank you!</p>