const tableParams = [ {
key: ‘aa‘, defaultValue: ‘11‘
}, {
key: ‘bb‘, defaultValue: ‘22‘
},... ] let obj = {} tableParams.map(v => (obj[v.key] = v.defaultValue))
console.log(obj)
// {aa: "aaa111", bb: "bbb"}
原文:https://www.cnblogs.com/huxiuxiu/p/14602334.html