【发布时间】:2019-08-03 01:29:43
【问题描述】:
我有一个看起来像这样的对象数组
const data = [
{id: 1, locale: 'en'},
{id: 2, locale: 'nl'}
]
现在我正在尝试过滤掉数组中每个项目中的 locale 属性(不要永久删除它,只需过滤一次),因此我的数据理想情况下类似于:
const data = [
{id: 1},
{id: 2}
]
我试过了
-
使用地图功能展开属性,但我不知道如何继续。
this.translations.map(translation => { return { ...translation } })
【问题讨论】:
-
其实我想排除其他值。因为可能有更多的价值
标签: javascript ecmascript-6 ecmascript-5