async...await syntax allows us to write asynchronous code that reads similarly to traditional synchronous, imperative programs.
async...await syntax is syntactic sugar— it doesn’t introduce new functionality into the language, but rather introduces a new syntax for using promises and generators. Both of these were already built in to the language. Despite this,
async...await powerfully improves the readability and scalability of our code. Let’s learn how to use it!
In this lesson, you’ll be given a code-editor to write your code and a bash terminal to execute your code. To execute your program, you’ll type
node app.js in the terminal and hit enter (or return). You’ll press the “Check Work” button to submit your code for evaluation.
Check out the code we provided. It shows three ways of accomplishing the same task: reading and printing from two files in a specified order:
Don’t worry about understanding the
async...await syntax— that’s what you’ll learn in this lesson! If you haven’t already, type
node app.js into the terminal and press enter. Then, press “Check Work”.