Skip to content

Instantly share code, notes, and snippets.

@senthilmpro
Created November 12, 2019 02:57
Show Gist options
  • Save senthilmpro/a31c8915a8b9d1f30d16cbe3c4351c55 to your computer and use it in GitHub Desktop.
Save senthilmpro/a31c8915a8b9d1f30d16cbe3c4351c55 to your computer and use it in GitHub Desktop.
es6-javascript-wait-function-promise
/**
* Sets a delay for 'wait' milliseconds
* @param {Number} wait - wait time in milliseconds
*/
let delay = async (wait) => {
console.log(`Waiting for ${wait} milliseconds`);
return new Promise(p => setTimeout(p, wait));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment