Javascript – Why is catch function called twice on the same promise?
I'm trying to understand how promises work under the hood in JS and faced with this example: const promise = Promise.reject(); promise .catch(() => console.log(1)); promise .catch(() => console.log(2)); // Output: // 1 // 2 const promise = Promise.reject(); promise…