Open LuckyWinty opened 4 years ago
const promise = Promise.resolve() .then(() => { return promise }) promise.catch(console.error)
输出:[TypeError: Chaining cycle detected for promise #] 解释:promise.then 类似于 process.nextTick,都会将回调函数注册到 microtask 阶段。上面代码会导致死循环