Created
August 21, 2013 10:15
-
-
Save calvinmetcalf/6292736 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
function addPromise(a,b){ | |
return resolve(a,b); | |
} | |
addPromise(2,3).then(function(data){ | |
console.log(data); | |
},function(err){ | |
console.log('oh noes!'); | |
}); | |
//the error could be called if say this other function returns a promise and errored | |
somethingelse().then(function(data){ | |
return addPromise(data,2); | |
}).then(function(data){ | |
console.log(data); | |
},function(err){ | |
console.log('oh noes!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment