In this video I will show you how to use promises to deal with asynchronous data in JavaScript ES2015
Source Code – https://github.com/bradtraversy/youtube_es2015_source/tree/master/09_promises
CHECK OUT MY ES2015 COURSE: https://www.eduonix.com/affiliates/id/16-10397
Original source
42 responses to “JavaScript ES6 / ES2015 – [10] Promises”
Best promises made ever
This explanation is shit, you don't even need the promise code for async requests
You're just coding and not explaining anyting!
Really good practical video, thanks for posting.
I am getting the following error:
"Failed to load http://jsonplaceholder.typicode.com/todos: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access."
Can anyone help?
https://jsonplaceholder.typicode.com
nice api parser
Why have then((success)=>{…}, (fail)=>{…}) if the fail part is never used? Nobody is using the fail, any error handling is in the catch. But why have the fail function in the then? What does it do?
Still not sure I fully understand promises, but thanks for the API example. I have been struggling with an idea for a while and your example got me going. Was able to authenticate and pull data from the API and put it into the page. Baby steps for sure, but dang it feels good to at least be moving. Thanks for the great videos.
Thanks for this tutorials. Really helpful
Anyway, it feels like that dude is not a coder. If you are going to use that code with a POST method , it won't work. Guess why . little hint (with POST we send data to a server )
Brad, can you also add in a segment relating to async & await functions?
Thank you, needed a refresher on this subject. It was a helpful video for me.
good video, hard to concentrate with the second window taking up so much room on the screen though.
Well explained. Thanks a lot. Those who don't understand you guys need to learn about XHR and Ajax
Didnt understand this at all dear Brad. You just typed the codes 🙂
Ugh…ohh boy, gonna have to watch this a few times to get my head around. I feel like I must have missed out on a previous lesson. Cool stuff though I guess…once you understand how it all goes together. Just starting on Node.js.
Gol Durnit Bradley, you did it again.
Spent 20 min searching for a dead simple explanation of promises for a particular issue I was having. Watched 5 minutes of your video and 'resolved' my issue.
Thanks again bro-town.
Hi Brad , thx for the tutorial so accurate! please in the future could you make more ES6 / ES7 syntax/concept tutorial? we appreciate that, thanks so much for your work
somewhere you are using 'this' elsewhere using using 'xhr' not even clear in your code why used this and why used xhr very confusing
the very first dislike i am going to pass to this channel only code no explanation -_-
It works and I have no idea why, lol.
the best ever !
This is more of a tutorial on how to parse a website ..
I've just finished building an online workshop for testing TraversyMedia video series on learning JavaScipt ES6
—
Online demo: https://medunes.net/es6-training/
Github Repo: https://github.com/MedUnes/es6-training
what is the difference between
.then(successCallback,failureCallback)
and
.then(successCallback).catch(failureCallback)
Question is when and why will you use a promise?
thanks 🙂
no explanation. just typed code.
Writing code without any sort of explanation what is happening. First down vote in my entire life
Now Angular makes more sense, thank you.
I am new to javascript. This ES6 has more familiarity with java and python than with jquery. Should I learn this for webdev or
is there another javascript version (angular,… sorry don't know what that is so far) which is higher in demand? Thanks
Keep like that, ass everything, BUT SIMPLE, EVERYONE CAN UNDERSTAND 🙂 ! Super.
Great tut, thanks 😉
great tutorial, thanks 🙂
the same is done behind the function Ajax?
Thanks. It's awesome
Niiiiice! Thanks.
When I think about Javascript, the name I remember is Brad 😉
This was one of the best and simplest tutorials I've seen so far. Very appreciative.
Shit… I'm getting error:
𝗩𝗠𝟮𝟬𝟱𝟳:𝟭𝟬 𝗨𝗻𝗰𝗮𝘂𝗴𝗵𝘁 𝗧𝘆𝗽𝗲𝗘𝗿𝗿𝗼𝗿: 𝗖𝗮𝗻𝗻𝗼𝘁 𝗿𝗲𝗮𝗱 𝗽𝗿𝗼𝗽𝗲𝗿𝘁𝘆 '𝘀𝘁𝗮𝘁𝘂𝘀' 𝗼𝗳 𝘂𝗻𝗱𝗲𝗳𝗶𝗻𝗲𝗱(…)
on this line:
𝗶𝗳(𝘁𝗵𝗶𝘀.𝘀𝘁𝗮𝘁𝘂𝘀 >= 𝟮𝟬𝟬 && 𝘁𝗵𝗶𝘀.𝘀𝘁𝗮𝘁𝘂𝘀 < 𝟯𝟬𝟬) {
This code is inside 𝐱𝐡𝐫.𝐨𝐧𝐥𝐨𝐚𝐝 function.
What should I do?
best javascript promises tutorial so far