SOURCE

let data = [
    {
        dydj:'220v',
        zzcot:'3',
        gzcot:'5'
    },
    {
        dydj:'20v',
        zzcot:'1',
        gzcot:'6'
    },
    {
        dydj:'100v',
        zzcot:'0',
        gzcot:'5'
    },
    {
        dydj:'200v',
        zzcot:'3',
        gzcot:'7'
    }
];

var zzData = [];
var gzData = [];
let zzObj = {};
let gzObj = {};

function sortData(){

    console.log(i);
    gzObj.name = data[i].dydj;
    gzObj.value = data[i].gzcot;
    gzData.push(gzObj);
    console.log(gzObj);
    // zzObj.name = data[i].dydj;
    // zzObj.value = data[i].zzcot;
    // zzData.push(zzObj);
};
(function data(){
for(let i = 0; i < data.length; ++i){
    sortData()
}})();



console.log(gzData);
// console.log(zzData);
console 命令行工具 X clear

                    
>
console