Created
November 12, 2019 02:57
-
-
Save senthilmpro/a31c8915a8b9d1f30d16cbe3c4351c55 to your computer and use it in GitHub Desktop.
es6-javascript-wait-function-promise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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