js数组转换

var data ={id:"11",name:"张三"};

var keyMap = {id: "序列", name: "姓名"};

var objs = Object.keys(data).reduce((newData, key) => {
let newKey = keyMap[key] || key
newData[newKey] = data[key]
return newData;
}, {})
console.log("----------------------",objs)
上一篇:JS 小驼峰与下划线命名法互转


下一篇:php 补全日期查询中缺少的日期