promiseFactory(0)
.then(count => { return promiseFactory(count); })
.then(count => { return promiseFactory(count); })
.then(count => { return promiseFactory(count); })
.then(count => { return promiseFactory(count); })
promiseFactory
を実行した際にPromiseがnew
されるため,これらのthen()
がそれぞれ返すのは毎回別のPromiseインスタンスであることに注意してください.
一度生成したPromiseインスタンスは,1回実行されたのち動作を終了します.
すでにresolve
されたPromiseインスタンスを返しても,そのままthen()
にスキップされるだけです.