Working with promises in JavaScript is a great way to handle asynchronous operations, yet it can be confusing for many developers. This snippet collection covers the basics of promises and how to use them to handle everyday operations, as well as some more advanced topics.
JavaScript's promises represent the eventual completion (or failure) of asynchronous operations and their resulting value.
JavaScript, Function · Oct 24, 2021
Learn everything you need to know about promises and asynchronous JavaScript with this handy cheatsheet.
JavaScript, Function · Jun 12, 2021
Understanding the differences between synchronous and asynchronous code is a crucial piece of knowledge for every web developer.
JavaScript, Function · Nov 14, 2021
Messing up the order of chained then
and catch
methods in JavaScript promises can cause problems. Here's a short primer on the subject.
JavaScript, Function · Jun 12, 2021
A JavaScript promise's then
and finally
methods seem very similar. But there are a few important differences you need to keep in mind.
JavaScript, Function · Jun 12, 2021
Oftentimes you might need to add a timeout to a promise in JavaScript. Learn how to do this and more in this short guide.
JavaScript, Promise · Jun 12, 2021
Creates a debounced function that returns a promise.
JavaScript, Function · Oct 19, 2020