JS Promises: if a handler in a `then` block returns a value vs returning a resolved promise, does the `then` block handle it the same way?
问题 Say I have a function that returns a resolved promise like this: let a = () => {return new Promise(res => res(1))} and then I then-ify it like this: a() .then(val => {return new Promise(res => res(1))}) Here the then contains a handler that returns a promise resolved with 1 , so the then block returns a promise resolved with 1 as well. Is that right? Then say instead we have this: a() .then(val => {return 1}) The handler returns 1 instead of returning a promise resolved with 1 . What I Want