let localData = {
name: '',
sex: ''
}
let resData = {
name: 'zzs',
sex: 'boy',
age: 18,
birthday: '10-21',
address: 'demo'
}
localData = resData
// { name: 'zzs',
// sex: 'boy',
// age: 18,
// birthday: '10-21',
// address: 'demo' }
console.log(localData)
The result I hope to get is { Name: "zzs", Gender: "Boy" }
I don't want to do it in the following way.
localData.name = resData.name;
localData.sex = resData.sex;
Is there a good performance method that can be achieved? thanks