JS 对象转化为数组

上代码:

let result = {'121332':'dedsdf','3434':'fgfsdf','3477':'dhff'};

let resultArr = [];
for(let item in result){
    let objTmp = {};
    objTmp.id = item;
    objTmp.value = result[item];
    resultArr.push(objTmp)
}

console.log(resultArr)

  后注:快有大半年没写博客了,期间发生了很多事情,从上海来到了南京,我以为自己以后都会在上海了,偶然的机会来到南京两个月了。加入了苏宁IT,算是进入了大公司;继续学习吧!

原文地址:https://www.cnblogs.com/lhd404/p/9141673.html