异步改同步
var obj = { name: '123' }
function testAwait(){
obj.name = '789'
return new Promise((resolve) => {
setTimeout(function(){
console.log("testAwait", obj.name);
resolve();
}, 1000);
});
}
async function helloAsync(){
await testAwait();
obj.name = '456'
console.log("helloAsync", obj.name);
}
helloAsync();

浙公网安备 33010602011771号