DEV Community

Discussion on: Explain Async/Await Like I'm Five

hunter profile image
Hunter Henrichsen • Edited on

I'll throw my hat into the ring.

Let's say you're running a race, and there are water stations set up along the way. You can keep running down the main path, or hop off to the side to one of the water stations. Some of them have lines, and you have to wait your turn before you can get water and go back to the main path. To await means to be one of the people waiting in line, because you're *wait*ing for the person in front of you to finish what they're doing. For a minute, the two runners are joined together and can only go as fast as the first of them. Waiting in line makes it so that other people can queue up behind us (we have to be marked async, which means other people can await us before we can await someone else).

In terms of code, this makes it much cleaner and straightforward, as I think Davyd has demonstrated.