Immediate function invocation, add binding to console.log - Javascript Function

Javascript examples for Function:Function Bind

Description

Immediate function invocation, add binding to console.log

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from   w  w  w.j  av  a 2 s  .  c o  m*/
var app = function () {
    var ans = {
        power: console.log.bind(this, 'power'),
        wow: console.log.bind(this, 'wow')
    }
    return ans;
}();
app.power();
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials