javascript sleep 1 seconds code example
Example 1: javascript wait 1 second
setTimeout(function(){
console.log("Ready")
}, 1000);
Example 2: 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);
}