16.15: Promise.all() - Topics of JavaScript/ES6

Поделиться
HTML-код
  • Опубликовано: 31 май 2018
  • In this video, I discuss handling arrays of asynchronous JavaScript promises with Promise.all() .
    🎥 Next Video: • 16.16: try / catch wit...
    🔗 Promise.all() on MDN: developer.mozilla.org/en-US/d...
    🔗 Giphy API: developers.giphy.com/
    🔗 Wordnik API: developer.wordnik.com/
    🎥 ES6 Arrow Function: • 16.3: ES6 Arrow Functi...
    🚂 Website: thecodingtrain.com/
    💖 Patreon: / codingtrain
    🛒 Store: www.designbyhumans.com/shop/c...
    📚 Book recommendations: www.amazon.com/shop/thecoding...
    💻 github.com/CodingTrain/website
    🎥 For more videos on ES6/JavaScript: • 16: Topics of JavaScri...
    🎥 For more Coding Challenges: • Coding Challenges
    🔗 p5js.org/
    🔗 processing.org
    📄 Code of Conduct: github.com/CodingTrain/Code-o...

Комментарии • 119

  • @erikakerberg1104
    @erikakerberg1104 6 лет назад +96

    Never stop doing these. This is positively the best coding channel on RUclips.

  • @ChrisFotosMusic
    @ChrisFotosMusic 4 года назад +98

    the most impressive thing about daniel shiffman is that he somehow learned to code *without* watching any coding train videos

    • @arlomusa1400
      @arlomusa1400 3 года назад

      i guess it's kinda randomly asking but does anybody know of a good site to stream newly released movies online?

    • @vincentethan9528
      @vincentethan9528 3 года назад

      @Arlo Musa try flixzone. Just google for it :)

    • @emerymarcus3710
      @emerymarcus3710 3 года назад

      @Vincent Ethan definitely, been using FlixZone for years myself =)

    • @arlomusa1400
      @arlomusa1400 3 года назад

      @Vincent Ethan thanks, I signed up and it seems to work :D Appreciate it!

    • @vincentethan9528
      @vincentethan9528 3 года назад

      @Arlo Musa happy to help :D

  • @ArunK678
    @ArunK678 4 года назад +9

    Damn i just saw his async await in recommendations list. This guy says "in my previous video" .
    Me: ok let me check first of the series
    I just forgot I'm here to gain knowledge and watched as if its a movie.
    Believe it or not I'm into JS and react since 2 years. Never got this stuff stuck in my head as better as this.
    I'm just grateful to u. Thanks a ton

  • @pesahson
    @pesahson 3 года назад +4

    I've decided to really understand async JS, instead of just doing api calls without fully knowing what's going on and your videos helped a lot. they're fantastic.

  • @florianspringer8581
    @florianspringer8581 4 года назад +9

    Thank you for the series! Going through the evolution of the asynchronous concept step by step made it a lot more clearer to me.

  • @RandStuffOfficial
    @RandStuffOfficial 6 лет назад +40

    10:42 "aPEARing" 😎

  • @0x0abb
    @0x0abb 2 года назад +3

    it's actaully nice to see it live and how these small mistakes happen to everyone - nice work in all!

  • @ppena120
    @ppena120 3 года назад +3

    Thanks for these videos. These are super good and breaks everything down in a very entertaining way yet super educative.

  • @ianchui
    @ianchui 6 лет назад +3

    oh my gosh, this is so useful for what I am doing. thank you!!

  • @mikegogl
    @mikegogl 4 года назад +4

    Thank you man thank you. It sucks that I am paying for a curse and keep coming back here to understand whats going on in the paid course. I will contribute for sure my friend!

  • @saurabh7489
    @saurabh7489 3 года назад +1

    Thank You very much Sir. This is one of the best coding tutorials I have seen.

  • @danhle7999
    @danhle7999 3 года назад +1

    keep doing great work sir, this is the first time I watch your video and I am impressed with your enthusiasm and passion thank you you have my support

  • @sulaimanharith7293
    @sulaimanharith7293 3 года назад +1

    one of the best coding channel. you are very cool way of sharing your knowledge to others. Great job.

  • @Raftor74
    @Raftor74 6 лет назад +2

    Thank you for your awesome videos! Very good examples.

  • @MichalZisman
    @MichalZisman 3 года назад +1

    02:10 "I'm trapped in an ATM vestibule with Jill Goodacre!"\
    On a more serious note, I am getting ready for an interview, and this really helped me understand Promise.all(). Thanks!

  • @blusanders
    @blusanders 3 года назад +1

    Always so helpful. Thank you!

  • @assaulterpt
    @assaulterpt 3 года назад +1

    My dude, thank you very much! I was having this problem creating a list for the sidebar navigation of my site.

  • @michaelcarnevale5620
    @michaelcarnevale5620 3 года назад

    the skeleton made it immediately clear to me, and i didn't realize it required an array as argument.. great vid thnx

  • @luizrodrigo8778
    @luizrodrigo8778 4 года назад

    This video is amazing! You're the best!

  • @creativeplanet2820
    @creativeplanet2820 3 года назад +1

    They're returned in the same exact order as they were set in the array, that's the main takeaway for u if ur in a hurry or on an urgent product bug fix, like i was :D finely explained !

  • @antonioquintero-felizzola5334
    @antonioquintero-felizzola5334 5 лет назад +1

    Another great video, as usual.

  • @kartikshirke9542
    @kartikshirke9542 4 года назад +1

    You make things look easy!

  • @eleazarmaestre7446
    @eleazarmaestre7446 5 лет назад

    Great video my friend! Thank you. Take care😁😄

  • @sabirmohammedi
    @sabirmohammedi Год назад +1

    Great videos! thanks for making the concept clear in such a simple way..

  • @suryamanipandey4752
    @suryamanipandey4752 2 года назад +1

    A great Teacher you are

  • @kevintraets
    @kevintraets 4 года назад

    Seriously dude, one of the best tutorial serie out there

  • @rnmmakings4989
    @rnmmakings4989 4 года назад +1

    hello sir, really you are amezing.. bcoz you create a comic environment while occurring error on your video and its intresting

  • @farzanehparvar_
    @farzanehparvar_ 4 года назад

    Great video. Thank you for sharing.

  • @angular_tutoriales3105
    @angular_tutoriales3105 2 года назад

    Thank you soo much!, I understand now!

  • @ankitsingh7919
    @ankitsingh7919 2 года назад

    detailed explaination... why and how it works this way .. thanks for this video

  • @zinsy23
    @zinsy23 4 года назад +2

    Awesome tutorial as always! I have been having this issue on my program that I'm doing for fun where I need to add a sleep to a function but I want the draw loop to keep going. I wonder if I can use this async/await to work around this?! I haven't worked on it for several months now but if I get back to it, I wonder if it will solve the problem. I'm excited to try it!

  • @rnmmakings4989
    @rnmmakings4989 4 года назад

    you are my favourite coder

  • @DevrajSinghRawat
    @DevrajSinghRawat 5 лет назад +1

    amazing series .. I had started with part 1 with no idea about promises but now I can promise that how to keep promise ;-)

  • @celina6204
    @celina6204 3 года назад +1

    i loved every minute of this

  • @phone5555482
    @phone5555482 3 года назад

    You are so good!

  • @dreamyrhodes
    @dreamyrhodes 3 года назад +1

    You could like in try catch send a resolve in the catch too. Then you'd not get an error that breaks the promise chain but still could in the catch jump the creation of the html elements but display an error gif instead. Of course it's fishy to use a resolve() in case of an error but here it would make sense since you still want the other gifs that work.

  • @BobbyBundlez
    @BobbyBundlez 2 года назад

    This was amazing

  • @motivatemindz3320
    @motivatemindz3320 2 года назад

    you are awesome. thank you so much.

  • @paramjeetdhiman1997
    @paramjeetdhiman1997 4 года назад

    Thank you! Sir.

  • @buhlemwanza632
    @buhlemwanza632 5 лет назад +1

    Great video man! Perfect timing too, that's a thumbs up from me! :)

  • @itshamiiid
    @itshamiiid Год назад

    thanks. helpful video.

  • @oguzhanyldrm8179
    @oguzhanyldrm8179 5 лет назад

    you are so cool bro keep doing tutorials

  • @JoeWong81
    @JoeWong81 5 лет назад

    Thanks a lot bro

  • @ismetomerkoyuncu1179
    @ismetomerkoyuncu1179 2 года назад

    Thank you so much. . .

  • @gabydewilde
    @gabydewilde 2 года назад

    yes kids, there is no onerror callback! If any of the promises doesn't work out nothing works anymore.
    Welcome to 2021!

  • @sebastianbg5369
    @sebastianbg5369 4 года назад +2

    Great Series! Thanks you. I've always wondered, what text editor do you use?

    • @TheCodingTrain
      @TheCodingTrain  4 года назад +2

      VSCode This workflow video series might help! ruclips.net/p/PLRqwX-V7Uu6Zu_uqEA6NqhLzKLACwU74X

  • @shaswatlenka3617
    @shaswatlenka3617 6 лет назад +5

    Hey! your videos are great! Can you make a video on how to read source code of a javascript related open source project, or just what should be the approach to jumping into source code? [PLEASE!]

    • @AbdallaElmedny
      @AbdallaElmedny 6 лет назад

      Shaswat lenka step 1- open gitbub, 2- find src folder or appropriate folder if its a mono repo, 3- start reading source code based on what you are interested ib

    • @shaswatlenka3617
      @shaswatlenka3617 6 лет назад +3

      Hey Abdalla! I know these things. Usually, Open Source Projects have a lot of dependencies and reading the source code becomes a heck of a job. I wanted a foolproof approach to dive into the large codebase and how to know what was in the mind of the programmer while writing a particular line of code.

  • @bavariancake9397
    @bavariancake9397 3 года назад +1

    So what's gonna be the alternative when we want to avoid that all will fail if one fail but still execute the code in the similar fashion?

  • @danser_theplayer01
    @danser_theplayer01 Год назад +1

    Oh yeah some websites lag a lot when loading all the ads and pictures and whatnot, and so they start to "crawl". I hate that, like I just aligned the article with my screen and now it's crawling down and I need to scroll again.

  • @LOLMAN22
    @LOLMAN22 5 лет назад +1

    Can you do a video on the loading bar?

  • @user-ow1ji4le4k
    @user-ow1ji4le4k 5 лет назад

    Thanks

  • @lukaskovar6921
    @lukaskovar6921 6 лет назад

    Wow that's so useful. Code is still becoming easier to learn and also to write. I think ES267 will have preincluded functions from P5.JS XD.

    • @blasttrash
      @blasttrash 6 лет назад

      what is es267? is that a specification number like java has with jsr etc? new to javascript. thanks

    • @nahueljo
      @nahueljo 6 лет назад +1

      He was just making a joke about a super-future version of the standard that would include functions from the P5JS library. ES5, ES6, ES7 and ES8 are the currently used specification versions. en.wikipedia.org/wiki/ECMAScript

    • @blasttrash
      @blasttrash 6 лет назад

      oh ok. thanks. :D

    • @romanemul1
      @romanemul1 6 лет назад

      to jo. Java krade od ceckaru a p5 od javy.

  • @elAmigo805
    @elAmigo805 6 лет назад +1

    Why would a for loop prevent the promise.all() to fail, if there's an error, where as the promise.all() by itself totally fail? Can someone provide a topic or subject on how this works so I could do a little more research online

  • @medAmineRg
    @medAmineRg 3 года назад

    thankyouu so much

  • @CyberPulseReport
    @CyberPulseReport 4 года назад +1

    whoops,,,,,, you are awesome
    whooOOOps,,,,,,, what an interesting series
    whoops ,,, whoops ,,,
    your teaching style is out of the box☺️ 😍 🎸 🙌 👏

  • @kornelijussliubauskas8299
    @kornelijussliubauskas8299 2 года назад +1

    Hey, does this work as ACID wrapper with the DB's? What I mean by that is if array of promises would simply be calls to mongodb and if any of them fail how does this all or nothing work then ? Thank you.

  • @dharashah6010
    @dharashah6010 3 года назад

    @2:50 word is, interpolation

  • @FaithFedora
    @FaithFedora 6 месяцев назад

    You are amazing. Pls make a react series 😩😩😩😩

  • @rafadydkiemmacha7543
    @rafadydkiemmacha7543 4 года назад

    11:00 why would you use that ugly for loop though?

  • @A_Lesser_Man
    @A_Lesser_Man 4 года назад

    albeit a little bumpy, still very informative, ty

  • @wimsmets4286
    @wimsmets4286 6 лет назад +4

    I love unlisted videos

  • @VeslorTV
    @VeslorTV 6 лет назад

    fun stuff

  • @misterl8129
    @misterl8129 3 года назад +2

    Anyone can tell me the difference between doing the promise all like he did VS
    Promise.all(promises.map(async(promise,i)=>{
    let data = await someRandomFunctionThatDelayIsRandom()
    return data
    })
    Thank u very much

  • @ahsanabbas4546
    @ahsanabbas4546 6 лет назад

    hi sir please make tutorial for arcgis api.. how can we publish json service from arcgis server to map and how can i edit json service as a client(means to say live editing on map to create line, point and polygon).

  • @myllacastro6297
    @myllacastro6297 5 лет назад +3

    Hey! I'm new to JS so I didn't get one thing: why is the wordGIF function returning a Promise? It seems to me like it is returning an object with the 'let' variables results but you're able to handle it as a promise... Can anyone help me?

    • @gabechevalier1567
      @gabechevalier1567 5 лет назад +4

      I know my reply is pretty late, but I looked it up and the reason behind wordGIF returning a promise is that async functions always return promises, so whenever you don't specify that it's a promise, the return value is wrapped in a resolved promise.
      So if you had a function like:
      async function 7isTheBestNumber() {
      return 7;
      }
      It would be the exact same as writing:
      async function 7isTheBestNumber() {
      return Promise.resolve(7);
      }
      I hope this helps!

    • @myllacastro6297
      @myllacastro6297 5 лет назад +1

      +Gabe Chevalier ah, okay, makes sense. Cool! Thank you, Gabe!

  • @cutaz1232
    @cutaz1232 2 года назад

    Please make a video promise.all() in angular. Thanks

  • @mahendranthivagar4890
    @mahendranthivagar4890 5 лет назад

    Please make a separate playlist for Topics of Javascript/ES6.

    • @TheCodingTrain
      @TheCodingTrain  5 лет назад +1

      ruclips.net/p/PLRqwX-V7Uu6YgpA3Oht-7B4NBQwFVe3pr

    • @mahendranthivagar4890
      @mahendranthivagar4890 5 лет назад +1

      @@TheCodingTrain Thank you so much for your quick response

  • @jacobpowell5648
    @jacobpowell5648 6 лет назад

    What are you programming on?

  • @anirudhbhardwaj8373
    @anirudhbhardwaj8373 6 лет назад +2

    how do you tell javascript if the right mouse button is click?

    • @shivamdubey8488
      @shivamdubey8488 5 лет назад +1

      hey javascript i am clicking the right mouse heck yeah !!

  • @nandarora8036
    @nandarora8036 6 лет назад +2

    Async function returns a promise. Period. Async function returns an object which has the word and the image url. It somehow feels a lot confusing. Can you please explain this? Thanks.

    • @cindy0092
      @cindy0092 5 лет назад

      "The async function declaration defines an asynchronous function, which returns an AsyncFunction object. "
      developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function

    • @bayrock1337
      @bayrock1337 5 лет назад

      It simply wraps the returned object into a new promise instead, because the function is async.

  • @juschu85
    @juschu85 6 лет назад

    Where can I see the Livestream? It looks like this video was just uploaded to RUclips.
    Are you using Twitch or something like that?

    • @TheCodingTrain
      @TheCodingTrain  6 лет назад

      I live stream right here on this channel! Click subscribe and the alarm bell to get notifications.

    • @juschu85
      @juschu85 6 лет назад

      I already subscribed but didn't activate notifications (I changed that now and this is the second channel where I did that).
      I'm used to the live chat that is displayed on live streamed videos even after the stream stopped. So I thought you brodcast the stream somewhere else.
      Do you cut the recorded stream into pieces and upload it sepreatel like regular videos and is that the reason why I don't see the chat?

  • @Vinsanity0050
    @Vinsanity0050 4 года назад

    @2:02 Does anyone know if once you have confirmed your application works correctly, in order to deal with a word from wordnikAPI not matching with a gif from giphyAPI, could you use a recursive approach and call on wordGif(num) again in the error handling? Would it keep running until it found a match for all words used to display?

    • @kongzilla2897
      @kongzilla2897 2 года назад

      Yes I think we can add one more recursive call in .catch

  • @paci
    @paci 4 года назад +1

    would change the "for" loop with a .forEach() :)

  • @habibsspirit
    @habibsspirit 5 лет назад

    Very nice. Excellent explanation with a good use case.
    It's "JIF" though.

  • @TURKISTONIM2
    @TURKISTONIM2 3 года назад

    it seems to me like using DO , WHILE instead of............

  • @lucashoffmannn
    @lucashoffmannn 5 лет назад

    I get CORS error when fetching from GIPHY. Sometimes it works, but most of the time it returns this error..

    • @andredoppelfeld4205
      @andredoppelfeld4205 5 лет назад

      U gotta create a new http Agent that doesnt reject unauthorized and pass it to the config of fetch
      const agent = new https.Agent({
      rejectUnauthorized: false
      })
      create a config variable and pass it to the fetch api. Maybe look it up in the docs.

  • @puneetsingh9678
    @puneetsingh9678 3 года назад +1

    9:25 me when I try to optimize the code which somehow worked

  • @user-cr3qu2eh8t
    @user-cr3qu2eh8t 6 лет назад

    Promise.Race

  • @dominichayes7253
    @dominichayes7253 5 лет назад +12

    Please share your secret for getting high on life :)

  • @jpflei7308
    @jpflei7308 6 лет назад

    Could you by any chance make a program in java that accesses excel and outputs it? Preferably in Eclipse Work-space and using the jxl plugins. It would help me learn the plugin and software a lot and I would GREATLY appreciate it. :)

  • @kuoroakihamza1235
    @kuoroakihamza1235 2 года назад

    9:25 Hamza is actually my name xd

  • @slashocodebeat4
    @slashocodebeat4 6 лет назад

    please make video on recurrent neural network in javascript

  • @syedbaryalay5849
    @syedbaryalay5849 6 лет назад

    i have to drop a like anyway, its Danial

  • @tarekkhalaily724
    @tarekkhalaily724 3 года назад

    code in github ?

  • @stiliankushev3453
    @stiliankushev3453 6 лет назад

    Can you make a snake game AI with tenserflow

  • @mohsintech2005
    @mohsintech2005 Год назад

    you are lovely