function test() {
let m = { a: 1, b: 2 };
let n = {};
return new Promise(function (resolve) {
for (let key in m) {
n[key] = m[key];
resolve(n)
}
})
}
test().then(function (r) {
console.log(r);
})
输出结果:
{ a: 1, b: 2 }
求解,为何输出不是{a: 1}
?