let result= {
name: 'John',
age: 30,
xingbie: 'male'
};
let { xingbie: sex, ...rest } = obj;
let user = { ...rest, sex };
console.log(user); // { name: 'John', age: 30, sex: 'male' }
欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) | Powered by Discuz! X3.5 |