What’s called exactly when a promise executor calls the resolve function before you attach a resolve function with ‘then’?
I swear nothing in this language makes sense. The promise executor is run immediately, and in this case it calls the resolve function, except a resolve handler hasn’t been attached yet:
Why does the following code resolves first instead of rejection?
How to upload base64 using an axios request
For all of the convert to base 64 functions I have found on stack overflow it requires using a promise. So i create a function that generates a new promise and I await on it for the response then return that. I use this function for all the files I am converting to base64 however for some reason when I get to my backend with the request it still says its a object.promise so I am assuming the await is not working correctly.
Why must I add a “then” after “finally” in order to chain promises?
Per this fiddle, if I try to call a second promise function from the .finally() block of the first promise, the second promise resolves but the resolve value is “undefined”.
However, if I call the second promise function in a .then block after the .finally block, everything works as expected. Why can’t I call the second promise in the .finally block of the first promise?
Javascript how to read PromiseState?
This is shown on by a console.log(mypromise);
Will a promise chain without a final call to then() that implicitly returns undefined or a call to catch() leave a promise pending indefinitely?
I’ve noticed in a promise chain that if I don’t make a final call to catch() or then() that returns a promise resolved with undefined (implicit or otherwise), it will leave a promise unresolved. This seems like a memory leak risk, so I’d like to ask if it’s always necessary to use one of the aforementioned ways of finishing up a promise chain? Of course, it seems sensible to allows catch anything that goes wrong in the promise chain anyway.
When a promise is returned from within a then() callback, does it replace the promise returned by the then() itself?
I’m trying to understand the inner workings of a promise chain. I know that a call to then() on a promise always returns a new promise.
Why is a Promise.reject returned in an async function not caught by a try-catch block inside that function?
I’m implementing an asynchronous function to fetch and show JSON data from an API.
“Uncaught (in promise)” Error using an asyncronous function with try/catch block
I’m implementing an asyncronous function to fetch and show JSON data from an API.
JavaScript await, try/catch and Microtask Queue
If I am not mistaken: