Answers for "javascript sync wait"

10

wait javascript

wait(ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
 }
Posted by: Guest on June-19-2020
1

javascript best way to create synchronous pause in program

console.log("Start");  
console.time("Promise");  
await new Promise(done => setTimeout(() => done(), 5000));  
console.log("End");  
console.timeEnd("Promise");
Posted by: Guest on November-21-2019
1

javascript synchronous wait

function delay(n) {  
  n = n || 2000;
  return new Promise(done => {
    setTimeout(() => {
      done();
    }, n);
  });
}
Posted by: Guest on June-15-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language