Await Expressions
Learn how await expressions assign the value of a promise to a variable and catch rejections.
We'll cover the following...
Using await
expressions
The await
expressions are designed to make working with promises simpler. Instead of manually assigning fulfillment and rejection handlers, any promise used in an await
expression behaves more like code in a synchronous function. The expression returns the fulfilled value of a promise when it succeeds and throws the rejection value when the promise fails. This allows us to easily assign the result of an await
expression to a variable and catch any rejections using a try-catch
statement. Here’s an example of using ...
Access this course and 1400+ top-rated courses and projects.