This for loop:
for (let i = 0, getI = () => i; i < 3; i++)
console.log(getI());
unrolls to:
This for loop:
for (let i = 0, getI = () => i; i < 3; i++)
console.log(getI());
unrolls to:
function resolveValue (promise, value, resolve, reject) { | |
if (promise === value) { // 不能resolve自身 | |
return reject(new TypeError('Can not resolve or return the current promise.')) | |
} | |
if (value === null || (typeof value !== 'object' && typeof value !== 'function')) { | |
return resolve(value) | |
} | |
let then // thenable可能是对象或者函数,它的then只能读取一次并且需要捕获可能的错误 | |
try { | |
then = value.then |