Created
June 15, 2020 21:00
-
-
Save phillipchan1/c912c213601a3303e98ff7d459ebd197 to your computer and use it in GitHub Desktop.
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
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