JavaScript wait 1 second

Posted by Paidboom - 5 months ago

JavaScript wait 1 second : Delay, sleep, pause, wait etc in JavaScript

function sleep(ms) {
  return new Promise(
    resolve => setTimeout(resolve, ms)
  );
}
async function welcomeMyCall() {
  console.log("Welcome");
  await sleep(2000);
  console.log("Pakainfo!");
  await sleep(2000);
  console.log("Love You too!");
}
welcomeMyCall();