Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

wait one second in javascript using async wait

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

async function test() {
  console.log('start timer');
  await delay(1000);
  console.log('after 1 second');
}

test();
Source by masteringjs.io #
 
PREVIOUS NEXT
Tagged: #wait #javascript #async #wait
ADD COMMENT
Topic
Name
8+1 =