• Monday , 14 October 2019

async / await in JavaScript – What, Why and How – Fun Fun Function

Code Canyon



💖 Support the show by becoming a Patreon
https://www.patreon.com/funfunfunction

async and await in JavaScript allows us to pause the execution of functions, and that allows us to write asynchronous code that reads like synchronous code.

🔗 Code snippets from the episode
https://gist.github.com/mpj/3f8bc0c6ecda4294fbeff99f1e3fae85

🔗 Promises video

🔗 Map video

🔗 Inline evaluation plugin
http://quokka.funfunfunction.com

🔗 mpj on Twitter

🔗 Help translate the show to your language
http://www.youtube.com/timedtext_cs_panel?tab=2&c=UCO1cgjhGzsSYb1rsB4bFe4Q

Inside a function marked as async in JavaScript, you are allowed to place the await keyword in front of an expression that returns a Promise. When you do, the execution of the async function is paused until that Promise is resolved.

The idea with async / await in JavaScript is to be able to write asynchronous code that flows like synchronous code.

Original source

3d Ocean

Related Posts

31 Comments

  1. Alejandro Corredor
    May 20, 2019 at 18:03

    Jo Mat, where's the link to become a patreon?

  2. Rafael Ribeiro
    May 20, 2019 at 18:03

    That was a great explanations about async await functions. Thanks

  3. jay thakkar
    May 20, 2019 at 18:03

    Which editor is that?

  4. BobbyBerberyan
    May 20, 2019 at 18:03

    Thank you.

  5. Lucas Amos
    May 20, 2019 at 18:03

    The aysnc await function you read at 7.20 is actually very clear now that I have watched this video, thanks!

  6. Academic. InArabic
    May 20, 2019 at 18:03

    is power clear, thank you so much

  7. Jason
    May 20, 2019 at 18:03

    boom!!

  8. Mohammed Hassan
    May 20, 2019 at 18:03

    I am a fan from Saudi ..

  9. Mohammed Hassan
    May 20, 2019 at 18:03

    I am a fan from Saudi ..

  10. Isaac Silva
    May 20, 2019 at 18:03

    Which plugin or sorcery he uses to debug response in real time like that?

  11. Big Box
    May 20, 2019 at 18:03

    One sip of that stuff and you achieve speedforce and a cardiac arrest in half a minute.

  12. Omar Iraqi Houssaini
    May 20, 2019 at 18:03

    Lovely! Bravo!

  13. wan afnan Hariz
    May 20, 2019 at 18:03

    dude when u doing coffee , i immediately click the liked button – thx for the humour, u made my day ! haha

  14. Justin L
    May 20, 2019 at 18:03

    Can someone tell me the vscode addon that shows the actual return values that he's using

  15. Don Bradfield
    May 20, 2019 at 18:03

    Don't button the bottom button of your blazer. Friend to friend.

  16. Ricardo Bossan
    May 20, 2019 at 18:03

    06:54 Final Fantasy VI's Victory Fanfare!

  17. Jo el
    May 20, 2019 at 18:03

    amazing quality, entertaining and an excellent presentation. Well done.

  18. Akshaykumar Chormule
    May 20, 2019 at 18:03

    I am not much cleared

  19. Mohit Yadav
    May 20, 2019 at 18:03

    Best part 19:24

  20. Peter M. Souza Jr.
    May 20, 2019 at 18:03

    how do you get those colored squares to the left of your code

  21. Justus Buyu
    May 20, 2019 at 18:03

    which package are you using to show the promises in vscode please?

  22. Ruby
    May 20, 2019 at 18:03

    Awesome explanation.. Thanks for sharing this.

  23. Peter Clausen
    May 20, 2019 at 18:03

    16:01 made me laugh hard 😂 The bee came at just the right time haha

  24. Vlad Lazăr
    May 20, 2019 at 18:03

    Outstanding content! Could you please do a follow-up on error handling in async functions?

  25. InvictuZ
    May 20, 2019 at 18:03

    That table better be plastic.

  26. Balla Baby
    May 20, 2019 at 18:03

    Was a tad stuck until I went to mdn's site and saw that .json() returns a promise. Not sure if you mentioned that in the video but it would have been a lot more helpful to know the return type

  27. Roberto Muñoz
    May 20, 2019 at 18:03

    so 20:57 requieres me to make a second comments….. for me… that's the basic example of why we need await…. great man, just great

  28. Roberto Muñoz
    May 20, 2019 at 18:03

    4:32 after 2 days trying to understand, 10 seconds of explanation finally openned my mind… thanks bro

  29. Dmitriy Obidin
    May 20, 2019 at 18:03

    Promises are fundamentally easier to read, cause they group parts that depend on each other in one chain call. With await it's hard to understand what vars needed where…

  30. subhash ekkaluru
    May 20, 2019 at 18:03

    Make it for beginners

  31. Michael Jenis
    May 20, 2019 at 18:03

    Very well done! Thank you for clearing this up and showing me how to mix vanilla Promises + async await!

Leave A Comment

You must be logged in to post a comment.