【发布时间】:2018-01-09 13:21:49
【问题描述】:
假设我有以下数组结构:
"stores" : [
{
id: 1,
name: 'lopd',
},
{
id: 2,
name: 'abc'
}
]
我想将参数名称更改为:
"stores" : [
{
value: 1,
label: 'lopd',
},
{
value: 2,
label: 'abc'
}
]
我将如何在 ES6 中做到这一点?
【问题讨论】:
-
你喜欢保留对象和数组,还是可以是一个带有新对象的新数组?
-
@NinaScholz 带有新对象的新数组有效,仅用于演示目的
标签: javascript arrays object ecmascript-6