Wait for any amount of time in milliseconds or resolve immediately if no value passed.
NodeJS ✔️
Browser ❌
npm i waiit
wait() // Returns a promise that resolves immediately
wait(5000) // Returns a promise that resolves after 5sec
const wait = require ( `waiit` );
const doSomething = async () => {
console.log ( `Start` );
await wait ( 5000 );
console.log ( `Wait` );
await wait ();
console.log ( `Finish` );
};
doSomething ();