Your files never leave your device
Advertisement

Promises & Async/Await

Async/Await is a modern syntax built on top of Promises. It makes asynchronous code look and behave a bit more like synchronous code.

Using Async / Await

Put async in front of a function, and you can use await inside it to pause execution until a Promise resolves.

Try It Yourself

        

Practice

Challenge 1: Write an async function that fetches a joke from an API (e.g., try finding a public joke API online) or just fetch a post from jsonplaceholder.

Related Guides

Sponsored Utility
While You're Here
Sponsored Recommendations
Advertisement