JS Promises: is doing `return(value)` in a `then` block the same as resolving?
问题 I have the following code: new Promise((resolve, reject) => { resolve(1) }).then(value => { return 2 }) I resolve the initial promise with 1 . Then in the then block I do return 2 . Does this return a promise resolved with the value 2? 回答1: Yes. Calling .then creates a new promise, and that promise will resolve to whatever you return in the callback. 来源: https://stackoverflow.com/questions/61510453/js-promises-is-doing-returnvalue-in-a-then-block-the-same-as-resolving