Last active
August 29, 2015 14:20
-
-
Save shrunyan/69ddbee381eab98e1d06 to your computer and use it in GitHub Desktop.
Playing around with ES6 Promises
This file contains hidden or 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
'use strict' | |
let promise = new Promise(function (resolve, reject) { | |
// Do shiz | |
if (false) { | |
reject(new Error('fucked up')) | |
} else { | |
resolve('true') | |
} | |
}) | |
promise | |
.then(function (res) { | |
console.log(res) | |
}) | |
.catch(function (err) { | |
console.log(err) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment