javascript Object assign 方法赋值
- 初始化
var object={ "a": 1, "b": 2 } var object_assigned = {"a": 10, "b": 20}
- 属性更改
-
Object.assign(object_assigned, map_object) console.log(object_assigned)
--->
{ a:1, b:2 }
-
Object.assign(object_assigned, {"a": 15, "c": 15}) console.log(object_assigned)
--->
{ a:15, b:2, c:15 }
-