es6对象结构赋值

 // const transferObj = {
          //   value: aggregations.all_zg.buckets[i].key,
          //   label: aggregations.all_zg.buckets[i].key,
          //   count: aggregations.all_zg.buckets[i].doc_count,
          // };
          这样对象用结构赋值怎么写

我是这样改得

        const transferObj
          ({value,label,count} = {
            value: aggregations.all_zg.buckets[i].key,            label: aggregations.all_zg.buckets[i].key,
            count: aggregations.all_zg.buckets[i].doc_count,
          })

但是不对,应该怎么写


ABOUTYOU
浏览 937回答 1
1回答

米琪卡哇伊

const { key: value, key: label, doc_count: count } = aggregations.all_zg.buckets[i];console.log(value, label, count);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript