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




๐Ÿ’– 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


31 responses to “async / await in JavaScript – What, Why and How – Fun Fun Function”

  1. 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

Leave a Reply