1. object.assign
Object.assign(target,source,souce...)
2. $.extend
$.extend( target [, object1 ] [, objectN ] )
3. lodash
lodash.assign(target,source)
4. 遍历赋值
for (key in source) {
// if (source.hasOwnProperty(key)) {
// if (source.hasOwnProperty.call(source, key)) {
if (Object.hasOwnProperty.call(source, key)) {
target[key] = source[key]
}
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。