let params = Object.assign({},obj,obj1)
//花括号{ }叫目标对象,后面的obj、obj1是源对象。对象合并是指:将源对象里面的属性添加到目标对象中去,若两者的属性名有冲突,后面的将会覆盖前面的 var obj1 = { test1: 1 } var obj2 = { test12: 1 } var params = Object.assign({}, obj1, obj2) console.log(params)
2024-01-11 17:55:46
let params = Object.assign({},obj,obj1)
//花括号{ }叫目标对象,后面的obj、obj1是源对象。对象合并是指:将源对象里面的属性添加到目标对象中去,若两者的属性名有冲突,后面的将会覆盖前面的 var obj1 = { test1: 1 } var obj2 = { test12: 1 } var params = Object.assign({}, obj1, obj2) console.log(params)