【发布时间】:2021-07-20 12:26:33
【问题描述】:
现在我有这样的对象
let arr = [{name:'first'},{name:'first1'}]
预计
[{value:'first'},{value:'first1'}]
我的尝试
let result = arr.map(el=>{
const {name, ...other} = el;
return {value: el.name, ...other}
})
【问题讨论】:
-
您的代码有效。有什么问题?
标签: javascript