Work that takes time.
WHAT ASYNCHRONOUS MEANS
Work that completes later, without blocking everything else.
WHAT REQUIRES IT
Network requests Reading files Timers Anything waiting on something external
WHY IT MATTERS
JavaScript runs on a single thread in the browser. Blocking it freezes the page entirely.
WHAT PROMISES ARE
Objects representing a result that will arrive later.
WHAT THE MODERN SYNTAX PROVIDES
Writing asynchronous code that reads sequentially.
WHY THAT MATTERS
Nested callbacks become unreadable quickly.
WHAT TO ALWAYS HANDLE
Failure.
WHY
Network requests fail routinely, and an unhandled failure leaves the interface in an unknown state.
WHAT TO SHOW THE USER
That something is happening, if it takes more than a moment What happened, on completion or failure
WHAT TO SET
A timeout, so a hanging request does not wait indefinitely.
WHAT TO BE CAREFUL WITH
Several requests whose order matters Requests triggered repeatedly before the first completes
WHAT TO DO ABOUT THAT SECOND ONE
Disable the control, or cancel the previous request.