Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

set delay javascript

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

async function sample() {
  console.log('a');
  console.log('waiting...')
  let delayres = await delay(3000);
  console.log('b');
}
sample();
 Run code snippet
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #delay #javascript
ADD COMMENT
Topic
Name
1+6 =