js修改对象的key值

<script>
  var array = [
    {
        count:1,
        itemName:"007"
    },
    {
        count:2,
        itemName:"008"
    }
  ]
  var result = array.map(item => { return { value: item.count, name:item.itemName } } )
  console.log(result)
</script>

 

posted @ 2020-09-15 14:01  SLfish  阅读(2977)  评论(0编辑  收藏  举报