← All videos

Engineering video

0:27 · 8 May 2024

JavaScript Interview Question from a REAL Senior Level Interview

Key concepts in this video:

1. Async Functions and Promises

Async functions act as syntactic sugar that wraps the function's code and returns a promise resolving with the function's return value.

Hear it at 0:00 →

Transcript

What does an async function returns and why? So, basically, async await is just a syntax sugar for promises. And whenever you write a sync in front of a function, it will basically wrap that code in a promise and return a promise that will resolve with the return of that function. So, whenever you have an async function, that function will return a promise that will end up resolving with whatever the return of that function is.