JS获取数组中对象的某些值
<script>var data = [ {value: 1048, name: 'jack' ,code:123},{ value: 735, name: 'zerk' ,code:234},{ value: 580, name: 'mark' ,code:456},];var newData = [];data.map((item,index) =&
·
<script>
var data = [ {value: 1048, name: 'jack' ,code:123},
{ value: 735, name: 'zerk' ,code:234},
{ value: 580, name: 'mark' ,code:456},];
var newData = [];
data.map((item,index) =>{
newData.push({
value:item.value,
name:item.name
})
});
console.log(newData);
</script>```
更多推荐
已为社区贡献1条内容
所有评论(0)