function waitTime(ms) { // for adding asyncness to the async function return new Promise(resolve => setTimeout(resolve,ms)); } code example
Example: await setTimeout
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function sleep(fn, ...args) {
await timeout(3000);
return fn(...args);
}