Using function context vs passing as parameter - Javascript Function

Javascript examples for Function:Function Variable

Description

Using function context vs passing as parameter

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  ww  .jav  a 2s  .c  o m
async(console.log, "This will display later.");

console.log("This will display first.");

function async(funct) {
    setTimeout.bind(null, funct, 0).apply(null, [].slice.call(arguments, 1));
}


    }

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

Related Tutorials