const arr = ['a','b']
const num = [
["1","2","3","4"],
["11","22","33","44"],
]
const result = [
{ a:"1",b:"11" },
{ a:"2",b:"22" },
{ a:"3",b:"33" }
]
var ret = []
for (var i = 0; i < num[0].length; ++i) {
var obj:any = {}
obj[arr[0]] = num[0][i]
obj[arr[1]] = num[1][i]
ret.push(obj)
}
console.log(ret)
result
网友评论