Is there any JavaScript method similar to the jQuery delay() or wait() (to delay the execution of a script for a specific amount of time)?
delay()
wait()
delay function:
/** * delay or pause for some time * @param {number} t - time (ms) * @return {Promise<*>} */ const delay = async t => new Promise(resolve => setTimeout(resolve, t));
usage inside async function:
async
await delay(1000);