Top 5 Async Mistakes for JavaScript Beginners (Don’t make these!)

Sdílet
Vložit
  • čas přidán 6. 07. 2024
  • Don’t make these beginner mistakes working with Async code in JavaScript!
    *QUESTIONS ABOUT MY SETUP*
    Check out my Uses page for my VS Code setup, what recording equipment I use, etc. www.jamesqquick.com/uses
    *STAY IN TOUCH 👋*
    Check out the Podcast - compressed.fm/
    Courses - jamesqquick.com/courses
    Newsletter 🗞 - www.jamesqquick.com/newsletter
    Follow me on Twitter 🐦 - / jamesqquick
    *DISCORD*
    Join the Learn Build Teach Discord Server 💬 - / discord
    *TIMESTAMPS*
    00:00 Intro
    00:30 Not Understanding Promises
    03:20 Not Using Correct Async Await Syntax
    06:15 Not Handling All Errors
    08:40 Not Writing Performance Code By Using Promise.all
    11:00 Awaiting When You Don't Need To

Komentáře • 33

  • @JohnDoeX1966
    @JohnDoeX1966 Před rokem +7

    James you asked awhile ago what kind of content we the viewers are looking for? This is exactly the kind of “top tips for [enter JS topic]” that we find the most helpful.
    Also, these videos are likely to go viral which would help out your viewer and subscriber count

    • @JamesQQuick
      @JamesQQuick  Před rokem +1

      Thank you so much for this response! My wife and i have been talking about this for a while, and that's basically what we came up with. Kinda getting back to the basic. Again, thank you for the positive feedback. It really means a lot!

  • @dopetag
    @dopetag Před rokem

    Nice tips, James! Thank you

  •  Před rokem

    Very, very useful!!

  • @NeverCodeAlone
    @NeverCodeAlone Před rokem

    Thx so much!!!

  • @TedDaddin
    @TedDaddin Před 11 měsíci

    James - thanks for the video. With the promises array and Promise.all() what's the memory limit? I run into this often. Also, with Promise.all() and the email example, it will stop execution when there is a failed promise. This can get tedious to know which emails were successful. I like using Promise.allSettled to know what was successful or failed.

  • @eusebiu1050
    @eusebiu1050 Před rokem +1

    The npm package called "express-async-errors" handles async errors for us, so it's not a must to do it manually

  • @darkrany2692
    @darkrany2692 Před rokem

    Thanks James for other good video 👍

  • @LePhenixGD
    @LePhenixGD Před rokem +2

    3:45 Won't that return an error since the "await" keyword can only be used inside an asynchronous function?

    • @JamesQQuick
      @JamesQQuick  Před rokem

      I actually didn't exactly think about that, but it seemed to work on my end. Actually kind curious why/how that works there

    • @MakaronNaOstro
      @MakaronNaOstro Před rokem

      good question

    • @grumpylibrarian
      @grumpylibrarian Před rokem +2

      @@JamesQQuick Top level of modules now work with await. This wasn't always the case, but it's been in place in Node and browsers for a while now. You can really screw yourself pretty badly with loading the module tree if you await something slow or circular at the top level, so be careful with it.

  • @manojbhamre6062
    @manojbhamre6062 Před rokem

    Great.... today i was facing performance issues with loop & async await... tommarow i will try...and hopefully it will work 😅

  • @yuusource2275
    @yuusource2275 Před rokem

    Good video.

  • @christopheanfry2425
    @christopheanfry2425 Před rokem

    Very good video. Really nice examples, always good to have a refresh on this topic, but sorry to say that not as good as your Remix swag 🤣🤣🤣 so jealous.

  • @LGelashvili
    @LGelashvili Před 7 měsíci

    " console.log(await loadPokemon(1)) " - Isn't this syntax incorrect? I mean "await" in the console.log.

  • @sarahwbs
    @sarahwbs Před rokem

    Chapter names would be super helpful in a video like this.

    • @JamesQQuick
      @JamesQQuick  Před rokem

      It actually does have the timestamp metadata. I'm not sure why it's not showing up...

    • @JamesQQuick
      @JamesQQuick  Před rokem

      Ah I had a typo. Fixed now!

  • @User-px6gz
    @User-px6gz Před rokem

    Which extension he is using which allows to console in the vs code ? 🙄

    • @JamesQQuick
      @JamesQQuick  Před rokem +1

      It's the Quokka extension. It's super nice!

    • @Raul-si7bn
      @Raul-si7bn Před rokem

      @@JamesQQuick that feature isn't fully free, is it?

  • @yehudz
    @yehudz Před rokem +1

    Why do you have to do stupid faces in the thumbnails? You're above that.

    • @JamesQQuick
      @JamesQQuick  Před rokem +1

      Well research shows those typically help with CTR, so that's why. Sorry if they're cringy :)