Anonymous functions with bind - Javascript Function

Javascript examples for Function:Function Bind

Description

Anonymous functions with bind

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(){//  w  w  w  .java 2 s  .c  o m

doSomething('omg',function(mark){
    console.log(mark);
}.bind(null, 'test'));

function doSomething(printthis,callback){
    console.log(printthis);
    callback();
}
    }

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

Related Tutorials