Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js wait for seconds

//A
setTimeout( () =>{
    //C - 1 second later
}, 1000);
//B
Comment

wait n seconds in js

function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

async function demo() {
  console.log('Taking a break for 2 seconds...');
  await sleep(2000);
  console.log('2 seconds later');
}

demo();
Comment

javascript wait 10 seconds

setTimeout(function () {
        // ...
    }, 10000);

// or

.then(() => {
  // ...
  ({ timeout: 10000 });
      });
Comment

javascript wait 10 seconds

setTimeout(function(){ 
2    console.log("Ready")
3}, 1000);
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue call method after delay 
Javascript :: border radius not working ios react native 
Javascript :: javascript date get current date 
Javascript :: regex validate link 
Javascript :: how to conver time format to 12 hours in javascript 
Javascript :: vue router push 
Javascript :: npx nestjs 
Javascript :: windows 10 toast notifications nodejs 
Javascript :: change icon sapui5 
Javascript :: how long old upvc 
Javascript :: router link active in vue.js 
Javascript :: slug javascript 
Javascript :: javascript remove empty elements from array 
Javascript :: horizontal scroll onclick react 
Javascript :: find unique elements in array javascript 
Javascript :: SyntaxError: Cannot use import statement outside a module 
Javascript :: javascript try catch finally 
Javascript :: node file change event listener 
Javascript :: datatable language 
Javascript :: scroll to bottom 
Javascript :: get width of a dom element js 
Javascript :: jquery selected label option 
Javascript :: javascript sleep 
Javascript :: javascript add alpha to hex 
Javascript :: remove item from localstorage 
Javascript :: urlencoded json express 
Javascript :: console.log color 
Javascript :: comprimento string javascript 
Javascript :: angular 9 how to get previous state 
Javascript :: array of characters to stirng javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =