DEV Community

Ruxin Qu
Ruxin Qu

Posted on

Asynchronous code

  • setTimeOut() is a built-in function that can tell the JavaScript program to wait.
const print = () =>{console.log('delay printing this please')};
setTimeout((print),1000);
console.log('I come first');
console.log('I come second');  
/*output: I come first
          I come second
          delay printing this please. */
Enter fullscreen mode Exit fullscreen mode

Top comments (0)