js结构封装,怎么把一个一维数组和二维数组,封装成另一种结构呢,代码如下
var colOne = [[
'account',
'accountName'
],
[
'wxHead',
'wxHeadImage'
],
[
'name',
'username',
'abc'
]];
var colTwo = ['field', 'title','formatter'];
const transFun = (colOne, colTwo) => colOne.map(n => {
let o = {};
n.forEach((m, j) => o[colTwo[j]] = m);
return o;
});
赞0
踩0