试图将新对象推入对象数组,并抛出未定义的异常,这是怎么实现的?
main.js
let array = [{name: "abc", PrimaryAcc: { test: 'test'}}];
// contains any empty object
const secondaryAcc = {
'copayEmployer': '0.00'
};
array.map(obj=> ({ ...obj, SecondaryAcc: secondaryAcc }));
console.log(array);
预期输出
[{name: "abc", PrimaryAcc: { test: 'test'}, SecondaryAcc: {
'copayEmployer': '0.00'
} }];