with lots of processes sharing the same thread • DOM rendering, network requests, your client-side code • They can’t all (and don’t have to) wait for each other
async before your function declaration • Await acts like .then() and pauses the execution until the promise is fulfilled • Looks like synchronous code, but waits in the background, instead of hanging the main thread • We get the performance benefits of asynchronous code and the readability of synchronous code • Best of both worlds!
You can use Babel, specifically babel-preset-env • automatically compiles your code based on the browsers you’re targeting • You can configure it to only include the polyfills and transforms needed for the browsers you support. • Transpiling only what's needed to make your bundles smaller