From Sunday, April 27th, 2025
“Promises” are a ubiquitous feature in the JavaScript language. For example, if you call the function fetch in order to get some kind of JSON object from an API, fetch will return a Promise:
const thisIsAPromise = fetch("/api/get-id/1");
What does that mean? The MDN documentation informs us that a Promise “is a proxy for a value not necessarily known when the promise is created.” That’s kind of true, and for a while, I even believed it. However, nowadays, I think that it’s actually easier to think of Promises as a way to manage code, not data.
Tagged as computers, javascript, explainers.