Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created September 6, 2017 04:39
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 goofmint/95a02b15ae4cac4a43d5b140aba43246 to your computer and use it in GitHub Desktop.
Save goofmint/95a02b15ae4cac4a43d5b140aba43246 to your computer and use it in GitHub Desktop.
new Promise(function(res, rej) {
  function loop(i) {
    return new Promise(function(resolve, reject) {
        setTimeout(function() {
            console.log(i);
            resolve(i+1);
        }, 100);
    })
  }
  loop(0);
}).then(function() {
  console.log("Finish");
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment