functions as objects tricks

by Gerald Gillespie

HTML

d1:<span id="d1"></span>

<br/>d2:<span id="d2"></span>

JavaScript

(function(){
  var fnObj = { fn1 : function(){ alert('fn1');},
             fn2 :   'somefunction',
             fn3 : '$.somethingfake'
            }
alert(this.fnObj);
})();
  
  
$('#d1').html(fn2.toString());