Skip to content

Instantly share code, notes, and snippets.

@phillipchan1
Created June 15, 2020 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phillipchan1/c912c213601a3303e98ff7d459ebd197 to your computer and use it in GitHub Desktop.
Save phillipchan1/c912c213601a3303e98ff7d459ebd197 to your computer and use it in GitHub Desktop.
const count = 5;
let current = 0;
function getAndTransformSurveys() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 500)
})
}
function doWhile() {
if (current < count) {
console.log('current :>> ', current);
getAndTransformSurveys().then(() => {
current++
doWhile()
})
}
}
doWhile()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment