ES6 came with many new features, but one of the best features was the official introduction of Promises. Promises allow you to write clean non-callback-centric code without ever having to worry about callback hell. Even if you never write your own promise, knowing how they work is incredibly important, since many newer parts of the JavaScript API use promises instead of callbacks. Checkout the full video to learn how to define and use promises.
Code From This Video:
Twitter:
Tweets by DevSimplified
GitHub:
https://github.com/WebDevSimplified
CodePen:
https://codepen.io/WebDevSimplified
#JavaScript #Promises #WebDevelopment
Original source
38 responses to “JavaScript Promises In 10 Minutes”
If you enjoy promises make sure to checkout Async/Await.
https://youtu.be/V_Kr9OSfDeU
I’ve commented before, basically the same thing, but I REALLY enjoy your style of teaching. To the point, understandable examples, and clean code. This is by far the best video on Promises I’ve seen yet. Thank you!
Thanks dude!
Hi there, great video!
Just a clarification from what I understood reading https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise , apparently the New Promise starts running its code as soon as it's defined ("the executor is called before the Promise constructor even returns the created object") so when you say that Promise.all will run the promises, from my understanding what actually happens is that every Promise gets executed at the moment they are created and Promise.all constantly checks if all are done. It's a matter of sequence, the Promise.all doesn't actually executes but waits for the results…
Gosh, I was trying to understand promises for like ever and you made it so easy. Great job!
JavaScript Promises are so simple, and of course, can be so useful! Excellent explanation and example given! Thanks.
Gezz, so easy to understand it with you!!! Thanks so much!!
The best tutorial on Promises! Thank you for your videos and efforts. Much appreciated.
Promise. What a weird name. BUT it helps a lot.
– In reality, I have a trust issue.
Awesome!!!
Hey, thanks a lot for the video. Worth every minutes!
I've been telling everyone about this channel, you are a very good teacher.
I don't understand how function 5:17 works fine if we don't feed "callback" and "errorCallback" arguments to it in the watchTutorialCallback.
I so much like you… Even if I haven't studied js.. your tutorial always help me in solving small probs in my projects.. now I promise to learn JavaScript
Great explanation thank you
Hi, Could you please make a video explaining the auto completion information in visual studio code. A break down of that would be useful. I mean all the information that comes with a method, constructor etc. Generally I understand the concept, but I have to remind myself sometimes. I think people might benefit from it.
great video 👍
thank you.
subscribed
thank
simple to understand
very nice and practical tutorial. Thanks,guy.
Good video, but I think you missed mentioning asynchronousness. It would make more sense to use a public api to fetch data then to just run synchronous code inside the promise.
Great explanation. Thanks!
Please use background color white
Fantastic explanation! My only feedback is to increase the font size in your editor for those of us watching on mobile (and I'm sure desktop would benefit) when doing these smaller examples. Would be a lot easier to read.
That feeling as a Java developer to see statements ending without semi-colon…
Really good tutorial. Perfect explanation and very easy to remember. Thanks !✌👏
Sir I have used promise.all with settimeout function but resolved messages of array is shown immediately
Show us about playing with string email id and phone number in JavaScript?
You just made THE BEST video promises bro. You rock!
Thx for the video, but I believe this is not completed. The exist of promise is to resolve callback hell. The video should explain more about this. And more important, async/await is missed out in this video. That's a very strong reason to use promise. From a async function, the promise will be returned implicitly. Using await can make your code a lot cleaner then using callback. That's the standard use case of promise.
Super Great!!!!
youtube.addEventListener('load', () => {
checkOut(recommended());
});
async function checkOut(video) {
let result = await watch(video);
if (result.channel=== 'Web Dev Simplified') { like(); comment(); return next(); }
close();
}
Great and super simple. Thanks
This was the first time I've watched an explanation of promises that made sense.
You are a magnificent instructor. Thank you! 🙂
Brad traversy is a great teacher and no disrespect to him but you explain things in a much simpler manner.Thanks man
Promise resolved! Thank you.
Great explanation. Thanks