In the docs its stated that The call to .then also returns a promise. If the handler that is called returns a promise, the promise returned by .then takes on the state of that returned promise.
So .then(my_func()) should take on the promise returned by my_func()
The first .then should take on the state of the promise returned by testfunc(), so in theory the second .then should print out "second". But this is not what happens, instead it prints out "first" from the first promise.
In the docs its stated that
The call to .then also returns a promise. If the handler that is called returns a promise, the promise returned by .then takes on the state of that returned promise.
So .then(my_func()) should take on the promise returned by my_func()
Take a look at this example:
The first
.then
should take on the state of the promise returned by testfunc(), so in theory the second.then
should print out "second". But this is not what happens, instead it prints out "first" from the first promise.