📜  合并对象 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:05.204000             🧑  作者: Mango

代码示例6
/* For the case in question, you would do: */
Object.assign(obj1, obj2);

/** There's no limit to the number of objects you can merge.
 *  All objects get merged into the first object. 
 *  Only the object in the first argument is mutated and returned.
 *  Later properties overwrite earlier properties with the same name. */
const allRules = Object.assign({}, obj1, obj2, obj3, etc);