Skip to content

Instantly share code, notes, and snippets.

@rohanBagchi
Created April 27, 2018 04:56
Show Gist options
  • Select an option

  • Save rohanBagchi/85c8b1ed2fba6a3f4bf72c00e6622aef to your computer and use it in GitHub Desktop.

Select an option

Save rohanBagchi/85c8b1ed2fba6a3f4bf72c00e6622aef to your computer and use it in GitHub Desktop.
(function main() {
getLargeNumber()
.then(function (number) {
console.log('We got ' + number);
});
})();
function getLargeNumber() {
return new Promise(function (resolve, reject) {
setTimeout(() => {
var value = Math.floor(Math.random() * 20000);
resolve(value);
}, 2000);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment