await new Promise(r => setTimeout(r, 2000)); code example
Example: javascript async await for x seconds
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function sleep(fn, ...args) {
await timeout(3000);
return fn(...args);
}