JavaScript Promise race method

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024
  • Similar to the JavaScript Promise.all( ) syntax, the Promise.race( ) method allows you to provide a series of Promises and only work with the result of the first one to Resolve.
    Code GIST: gist.github.co...
    Basic Promise video: • JavaScript ES6 Promise...
    setTimeout video: • JavaScript Timers - se...
    Promise.all( ) video: • JavaScript Promises al...
    MDN Promise.race( ) reference page: developer.mozi...

ความคิดเห็น • 20

  • @oah8465
    @oah8465 2 ปีที่แล้ว +1

    The man, the legend, the Steve Griffith teaching style. Simply thank you.

  • @honoredegg
    @honoredegg ปีที่แล้ว

    Thank you for the lesson, mr. Griffith

  • @yurashtefanko1603
    @yurashtefanko1603 3 ปีที่แล้ว +3

    I have never heard such nice explanation before this moment, Steve, I owe you a like and subscription.

    • @acederrick8146
      @acederrick8146 3 ปีที่แล้ว

      I know it is pretty off topic but do anyone know a good place to watch newly released series online?

    • @uriahhunter1117
      @uriahhunter1117 3 ปีที่แล้ว

      @Ace Derrick i dunno lately I have been using Flixportal. just search on google for it :P -uriah

    • @acederrick8146
      @acederrick8146 3 ปีที่แล้ว

      @Uriah Hunter thanks, I went there and it seems like a nice service :D Appreciate it!!

    • @uriahhunter1117
      @uriahhunter1117 3 ปีที่แล้ว

      @Ace Derrick You are welcome xD

  • @nikolayrusanov8714
    @nikolayrusanov8714 ปีที่แล้ว

    The best Promise.race explanation I have ever met. Thanks!

  • @ymazalmazal1757
    @ymazalmazal1757 5 ปีที่แล้ว +1

    Wow, so cool. Shot and sweet, thank you for sharing!

  • @GenerativeAI786
    @GenerativeAI786 8 หลายเดือนก่อน +1

    thanks a lot , I wish i could learn on site from you

  • @sakshigothivarekar842
    @sakshigothivarekar842 4 ปีที่แล้ว +1

    Amazing video. Explained nicely. Thank you. It helped me a lot.

  • @tezzarida
    @tezzarida 5 ปีที่แล้ว

    The way you explain is both very interesting and understandable. You are the only one who I listen to with a pleasure and without getting bored!
    That's a fantastic motivation for me! Thank you for your videos, Steve!
    P.S. What's the name of your dog? :))

  • @giorgibatsiashvili4270
    @giorgibatsiashvili4270 6 ปีที่แล้ว

    i finally have idea what promises..are thanks

  • @michael.knight
    @michael.knight 5 ปีที่แล้ว

    Clear explanation. In what kind of situation would you use this method?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  5 ปีที่แล้ว +3

      Usually when you are getting data from two sources but only want the first one that comes back and dont care which one comes back first.

  • @sidarjunful
    @sidarjunful 3 ปีที่แล้ว

    In real world examples of race is catch-reject is used or not?

  • @juniordallagnolo3983
    @juniordallagnolo3983 6 ปีที่แล้ว

    So Steve, basically that means if you do a race with some promises and one of them fails first than the other good ones you will always get an error result? You have to handle that into your code in a different​ way or is there a way to discard failed promises?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  6 ปีที่แล้ว +2

      Yes, the catch will be triggered by a critical failure like no network connection or a syntax error in your code. However, if you have an error of that magnitude then nothing is going to run anyway.