Skip to content
0:00 / 0:00

#asyncawait#promises#javascript

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

Fun Fun Function

257K subscribers • 6 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Mattias Petter Johansson, creator of Fun Fun Function

Intermediate. Assumes working knowledge.

254K views9 years ago2 recommendations

Programming languagesJavaScriptConcurrency and parallelism

Mattias Petter Johansson explains how async and await work in JavaScript to write asynchronous code that reads like synchronous code.

💖 Support the show by becoming a Patreon 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 gist.github.com/mpj/3f8bc0c6ecda4294fbeff99f1e3fae85 🔗 Promises video youtu.be/2d7s3spWAzo?list=PL0zVEGEvSaeEd9hlmCXrk5yUyqUag-n84 🔗 Map video youtu.be/bCqtb-Z5YGQ?list=PL0zVEGEvSaeEd9hlmCXrk5yUyqUag-n84 🔗 Inline evaluation plugin quokka.funfunfunction.com 🔗 mpj on Twitter twitter.com/mpjme 🔗 Help translate the show to your language youtube.com/timedtext_cs_panel?tab=2&c=UCO1cgjhGzsSYb1rsB4bF… 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. 💛 Follow on Twitch We record the show live Mondays 7 AM PT twitch.tv/funfunfunction 💛 Fun Fun Forum Private discussion forum with other viewers in between shows. funfunforum.com. Available to patron members, become one at patreon.com/funfunfunction 💛 mpj on Twitter twitter.com/mpjme 💛 CircleCI (Show sponsor) Robust and sleek Docker-based Continuous Integration as a service. I used CircleCI prior to them becoming a sponsor and I love that their free tier is powerful enough for small personal projects, even if they are private. Use this link when you sign up to let them know you came from here: circleci.funfunfunction.com 💛 Quokka (Show sponsor) Wonder how MPJ evaluates JavaScript inline his editor. Quokka is the answer - use this link when you buy to let them know you came from here: quokka.funfunfunction.com 💛 FUN FUN FUNCTION Since 2015, Fun Fun Function (FFF) is one of the longest running weekly YouTube shows on programming 🏅 thanks to its consistency and quality reaching 200,000+ developers. 🤦‍♂️ The Failing Together concept is what makes FFF unique. Most coding content out there focus on step-by-step tutorials. We think tutorials are too far removed from what everyday development is like. Instead, FFF has created a completely new learning environment where we grow from failure, by solving problems while intensively interacting with a live audience. Tutorials try to solve a problem. Failing Together makes you grow as a developer and coworker. 📹 Each show is recorded live on Twitch in a 2-hour livestream on Mondays. The host, assisted by the audience, is tasked to complete a programming challenge by an expert guest. Like in the real world, we often fail, and learn from it. This, of course, reflects what the audience identifies with, and is one of the most praised aspects of the show. ⏯ On Fridays, an ed

Why it's here

2 people recommend this

What people say. Highly recommended as a clear and approachable explanation of asynchronous programming patterns in JavaScript.

Moments people linked to

u/brianjenkins94in r/node • Recommends

On “Asynchronous patterns”

…the program where each data point can go from beginning to end without the application pausing somewhere along the line but this ventures into "premature optimization is the root of all evil." Write it the readable/approachable way first and then optimize as needed. The best pattern is the one that accomplishes the task. Watch this video once: [video And then this video 3 times: [video…

u/Mirkin321in r/node • Recommends

On “Variable stays undefined”

…could try async/await and await the variable promise to resolve. Or, you could move you console.log up into the body of the con.query function, so that it logs it after it is resolved. Either works, but async/await or just creating promises will serve you better in the long run if you need to do alot of this kind of thing :) I like this video: link to this video Also this one: [video…
2View on Reddit