This screencast explains the Javascript Promise pattern at a very high level. Promises are a fundamental tool for modern Javascript development, but it’s easy to get overwhelmed when first starting out.
All of the code is pseudo-code meant to make the concept of Promises easier to understand. In a real code base you probably want to use a promise library such as Q or Bluebird instead of using the native Javascript deferred object.
Original source
44 responses to “How to Use Javascript Promises”
Great video – thanks for explaining the token thingy at the end.
great stuff, really helpful. keep up the good work.
great tutorial ! thanks!
Well done
Thanks for making this video. Very clear and thorough examples.
Hey, could I talk to you? I am new to JS let alone ES6 but I need to store and get JSON information and use the objects for logic and view. I'm a little over my head. Trying not to bloat up with libs and I think this maybe the solution. Everything will be localStorage or hardcoded.
So much info so well presented, well done mate. I can see clearly now … π
Thank you Jordan …
before understanding promises and defered, i saw ur tutorial and got confused, but after knowing about it, when i saw it again, you were talking right lol
I am just starting to see the video but run into errors in console, why chrome console is throwing error in my case
var deferred = Promise.defer()
VM424:1 Uncaught TypeError: Promise.defer is not a function
at <anonymous>:1:24
Promise.defer wasn't throw safe so it was removed from Chrome. You can now create a custom deferred object using `new Promise` constructor syntax.
great post thanks this explains alot and gave me a clear understanding slides definitely helps π
Like totally, make sense dood π
Watched a bunch of videos and still had no idea what Promises were and how they worked. Watched YOUR video and I GOT IT!!!! You did a spectacular job explaining how it worked and how to use it in different situations. Thank you for you video.
Thanks for explaining so well that any js beginner can understand this.
awesome explanation …. most people explain promises in very dry and abstract manner…. what make this tutorial standout is will thought off real world uses of promises and the examples …. this indeed the best video on promises out there ….. thanks so much and please keep up ….
YOU ARE A BEAST
its worth noting that `Promise.defer` is obsolete now , I don't think that it even supported any more …
great tuturial thou
thanks
Amazing and wonderful explanation
Fabulous. Thanks. Super clear…
sadly, can't use Promise.defer() now in google chrome. π
You are the "Promise" God!! My search ends on this video.:)
"personified as a javascript object" .. wouldn't it be "objectified"
Great examples! Great video.
honestly one of the best online
Jordan, Excellent explanation, Thank you π
Great job! Really helped me get the concept. Thanks!
Impressive how well you explained the concept of JS promises in such an easy-to-understand way, kudos to you!
Awesome tutorial on such a complex topic. Huge respect.
Awesome, I was so confused with Promises, and this helped me understand it better. Thank you Jordan Leigh
one of the best explanations out there
Amazing tutorial. Excellent explanation.
Are you using the normal DevTool console from chrome? when i try the same code like:
var d1 =Promise.defer()
it says that "VM390:1 Uncaught TypeError: Promise.defer is not a function
at <anonymous>:1:17"
what am i doing wrong?
Never saw any video explain such concepts so effectively before. Subbed and liked.
what JavaScript framework do you recommend learning right now? I'm in the fence with angular2 and react: I'll prob learn both, but if you had to pick one to start with.. which would you pick? And then, what about the backend..?
Great explanation! It really helped me understand how to use the Q library a lot better.
Promise.defer() is now obsolete, https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred
Very good explanation! Thanks
this is it! thanks Jordan that was really helpfull! greetings from Venezuela, keep up the good work!
Good video!
Amazing thanks, keep going
Dude bro… Nicely done.
wow. Amazing! You made it so clear within seconds. The comparison to a progress bar was the moment when it began to make sence for me π Thanks!
You explained the whole deferred and promise thing in such a simple way. Thank you sir. Though some of the methods used are obsolete now, but is a good stepping stone to understand the new style.