Equivalent of set in ES6 to ES5

前端 未结 3 853
闹比i
闹比i 2020-12-21 05:15

I have a set over which I am iterating in ES6. I am trying to convert it to its equivalent in ES5. My build is getting failed because of ES6. That\'s why I am converting it

3条回答
  •  情歌与酒
    2020-12-21 05:40

    Why not just iterate through the data and map the result with Array#map.

    result = deviceList.map(function (item) {
        return { deviceName: item };
    });
    

提交回复
热议问题