Answers for "wait for a second before calling a function js"

103

js wait 1 second

function delay(time) {
  return new Promise(resolve => setTimeout(resolve, time));
}

delay(1000).then(() => console.log('ran after 1 second1 passed'));
Posted by: Guest on October-25-2021
6

js timer wait before functoin

//code before the pause
setTimeout(function(){
    //do what you need here
}, 2000);
Posted by: Guest on November-28-2019

Code answers related to "wait for a second before calling a function js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language