Ask Your Question
0

Regardless of the input, why does returning data from a .then() always result in the passing back of an object promise?

asked 2023-07-09 21:21:17 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-07-09 21:29:01 +0000

bukephalos gravatar image

Returning data from a .then() always results in the passing back of an object promise because .then() always returns a promise. Even if the callback function inside the .then() returns a non-promise value, it will still be wrapped in a promise object before being returned. This ensures consistency in the way promises are handled and allows for more seamless chaining of multiple promises together.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-09 21:21:17 +0000

Seen: 15 times

Last updated: Jul 09 '23