执行此操作的更简洁的方法是什么?
let formContext = {};
Object.values(screenContext).forEach(
(s) => (formContext = { ...formContext, ...s })
);
那么我想根据另一个对象
的值创建一个新对象您可以将其扩展到Object.assign
:
const formContext = Object.assign({}, ...Object.values(screenContext));