Javascript return vs return await (Crucial Difference)

Поделиться
HTML-код
  • Опубликовано: 20 дек 2024

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

  • @AngularUniversity
    @AngularUniversity  6 месяцев назад +2

    Looking to learn how to use async/await in Angular to build modern signal-based applications? Check out my latest course, which is just out - angular-university.io/course/angular-signals-course

  • @ali-13392
    @ali-13392 6 месяцев назад +3

    Vasco, I just wanted to say a HUGE THANK YOU for this video! It helped me understand a lot about promises & error handling! I'm working on a hobby project which will very soon involve "fetch" calls, so this is super valuable!
    Btw, I'm already annual member of Angular University. But I wanted to know, do you also do 1-1 calls/consultation? I would love to chat with you someday about few topics. Please let me know, thanks - Solat Ali

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

      Thank you Solat for choosing the Angular Univ. 😉 Right now I have way too much going on with the AngularUniv and onlinecoursehost.com, so I just don't have the time for 1 on 1 calls. 👍 It's something that I might try one day.

  • @AlainBoudard
    @AlainBoudard 6 месяцев назад +1

    Great content Vasco ! Valuable lesson 😎

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

      Thank you so much. Enjoy the videos and stay tuned for more!

  • @SiphiweGwebu
    @SiphiweGwebu 6 месяцев назад +1

    Great video 👌🏾
    At 5:57, where you add the try block, what's the extension/shortcut that instantly wrapped the below statement in the try block?

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

      Thank you, this is the one and only Webstorm, but with a Visual Studio Code Theme 😊

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

      Oh wow! Nifty!

  • @eswarbalasubramanian129
    @eswarbalasubramanian129 4 месяца назад

    Great explanation

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

    Very useful. Thank you.

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

      Thank you so much. Enjoy the videos and stay tuned for more!

  • @stevebor1
    @stevebor1 6 месяцев назад +1

    On the fetch you could have shown how to do a then / catch and resolve / reject, rather than wrapping in a try/catch.
    Great tutorial.

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

      I see what you mean, thank you for the suggestion. 👍

  • @tonystank8105
    @tonystank8105 3 дня назад +1

    hey Vasko where are you from ?

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

    Thanks for the content Vasco! 6:18 Is there any difference in putting the return null inside the catch block or just in the end of the function like you did?

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

      Thank you 😉 We need the return at the end, as every path needs to return the expected type.

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

    Thanks for the info! It is great! Regarding the await, if you have two awaits (one in onRequestTriggered and another one in getCourses), does it mean that you are executing two promises? could it be a performance issue if there were so many functions like that?

    • @AngularUniversity
      @AngularUniversity  6 месяцев назад +1

      Not at all, Promises don't cause performance issues. You can have as many awaits as you need, remember that the code after the await is only executed if the Promise gets resolved first. 👍

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

      @@AngularUniversity great! thanks for your response and for your amazing work!