Asynchronicity is the superpower that allows JavaScript to perform long-running tasks like fetching data without freezing the user interface.
1The Promise Contract
A Promise is a placeholder for a value that will exist in the future. It starts in a pending state and can either be fulfilled with a result or rejected with an error. This pattern allows you to write 'cleaner' asynchronous code by chaining operations together instead of nesting them in 'callback hell'.
2Async/Await: Sequential Logic
Introduced in ES2017, Async/Await is syntactic sugar on top of Promises. It allows you to write asynchronous code that reads like a sequence of steps, making it easier to reason about and debug. By using await, you pause the execution of the function (but not the main thread!) until the Promise resolves.
