0

In a function, normally you would use setTimeout() to delay a function. However, it will be kind of annoying when you need to use setTimeout() a number of times. For example:

function annoying(){
  setTimeout(function(){
    //code
    setTimeout(function(){
      //code
      setTimeout(function(){
        //code
      }, 3000)
    }, 3000)
  }, 3000)
}

So is there a simple function to delay it, like time.sleep in python?

Assorted
  • 35
  • 1
  • 5
  • Could be helpful - https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep – manpreet May 17 '22 at 07:04

0 Answers0