Skip to content

Instantly share code, notes, and snippets.

@punmechanic
Forked from Vannevelj/whydoyouwork.js
Last active November 23, 2015 11:45
Show Gist options
  • Save punmechanic/3b68e1a5833f8743be2e to your computer and use it in GitHub Desktop.
Save punmechanic/3b68e1a5833f8743be2e to your computer and use it in GitHub Desktop.
function doReplaceAsync() {
return myAsyncFunc()
.then(function(character) {
return input.replace(/a/g, character);
});
}
function myAsyncFunc() {
return new Promise(resolve => {
for(let i = 0; i < 1000000; i++) {
resolve('e');
}
});
}
doReplaceASync().then(result => console.log(result));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment