怎么把 [{key:"a",value:"1"}]转换成{"a":"1"}
怎么把 [{key:"a",value:"1"},{key:"b",value:"2"}]转换成{"a":"1","b":"2"}
回答
[{key:"a",value:"1"},{key:"b",value:"2"}].reduce((p, c) => (p[c.key] = c.value, p), {})
以上是 怎么把 [{key:"a",value:"1"}]转换成{"a":"1"} 的全部内容, 来源链接: utcz.com/a/23484.html