Definition
Async and await are programming keywords that let you write slow tasks (asynchronous tasks) so they read like plain, step-by-step instructions instead of tangled code. The rest of the program keeps running while the task finishes, and the order in which you get results stays neat and natural.
The Café Buzzer in Your Hand
Imagine you order a drink at a café and then just stand at the counter, staring into space until it's ready. The people behind you can't even order, and the whole shop grinds to a halt. Computer programs have the same problem. Downloading a big photo or fetching data from a faraway server takes longer than you'd think. If the computer froze everything until the data showed up, your screen would lock up completely.
So the computer hands the slow job off to someone else and gets on with other work right away. This is called "asynchronous processing." It's like taking your buzzer back to your seat and scrolling your phone while you wait. But the old way of writing this meant chaining instructions one inside another: "when the download finishes, do A; when A finishes, do B; when B finishes, do C."
Before long the code was being pushed further and further to the right, forming an unreadable staircase. Developers called this "callback hell." Async and await are tools that tidy up that messy, tangled code so it reads cleanly, one line at a time, from top to bottom.
A Perfect Division of Labor
The two words usually work as a pair. Await is generally used inside a function marked with async. Async (say "AY-sink") goes in front of a function name. It's a signpost that tells the computer, "This function contains something slow that we'll need to wait for." A function marked this way hands back its result in a special box that promises to deliver it in the future.
Inside the function, you put await (say "uh-WAIT") in front of the line that actually needs waiting. It's a pause signal that means, "Hold here for a moment until this task's result is ready." The function calmly waits right there, without moving to the next line, until the weather data has fully arrived from the server.
Here's the most important part: only that function waits for its turn. The rest of the program, including the screen, keeps running without stopping at all. Just as the coffee keeps getting made in the kitchen while you chat with a friend at your table, the computer keeps the screen smooth and quietly fetches the data in the background. One caution: if the function itself does a long, heavy calculation, the screen can freeze for as long as that takes.
A Bit More Precisely: The Magic of Syntactic Sugar
To be a little more precise, async and await are not a brand-new technology that changed how computers work. They are closer to a wrapper that makes an older tool easier for people to read. That tool is the Promise, an object that promises to give you a value in the future, which languages like JavaScript already used to handle asynchronous work.
In programming, syntax that works the same way underneath but is polished to be easier for humans to read and write is called "syntactic sugar." Inside the computer, promise boxes are still passed back and forth under the same complicated asynchronous rules. But to the developer writing the code, it looks like ordinary code that runs one step after another.
This straightforward structure also makes catching errors much easier. You can use the everyday error-handling syntax (try-catch) just as you always do, so when the internet drops or the server has a problem, you can easily find where the error happened and deal with it.
Common misconceptions
Using await freezes the whole program, so users can't even press a button.
Await only pauses the next line inside that one asynchronous function. While it waits, the rest of the program, such as the browser drawing the screen or the user's mouse clicks, keeps running without a pause.
Async/await was created as a replacement so you don't have to use Promises.
In JavaScript, async/await still runs on top of Promises under the hood. It is just a syntactic wrapper (syntactic sugar) that expresses Promise code in a form people find easier to read.
Where you meet it
In a shopping app, you use it to wait until the product list has been fully fetched from the server before showing it on screen.
When someone taps the login button, you use it to wait for the server to confirm the ID and password before moving to the next screen.
In one sentence
Async and await are programming keywords that let you write slow asynchronous tasks in an order that's easy for people to read.