Create your own async function with setTimeout() - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window setTimeout

Description

Create your own async function with setTimeout()

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  a v  a  2 s.c  om*/
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