How to merge multiple arrays (more than 3) of js into json form

topic description

arr1 = [1,2,3,4,5];
arr2 = [A1, a2, A3, A4, A5];
arr3 = [b1, b2, b3, b4, b5];
arr4 = [C1, c2, c3, c4, c5];
arr5 = [11,22,33,4455];
multiple arrays are similar in this form. The content in the array is uncertain
needs to be merged into this form
[
{"a": "1", "b": "A1", "c": "B1", "d": "C1", "e": "11"},
{"a": "2", "b": "a2", "c": "b2", "d": "c2", "e": "22"},
{"a": "3", "b": "A3", "c": "b3", "d": "c3", "e": "33"},
{"a": "4", "b": "A4", "c": "b4", "d": "c4", "e": "44"},
{"a": "5", "b": "A5", "c": "b5", "d": "c5", "e": "55"}
]

two arrays I use two for loops nesting and if statements to determine if there are more (5-6 arrays) of push into the object
what"s a better way?

Nov.04,2021

pass in the array dynamically, and calculate the key, dynamically. The code is as follows:

import _ from 'lodash'
const arr1 = [1, 2, 3, 4, 5];
const arr2 = ['a1', 'a2', 'a3', 'a4', 'a5'];
const arr3 = ['b1', 'b2', 'b3', 'b4', 'b5'];
const arr4 = ['c1', 'c2', 'c3', 'c4', 'c5'];
const arr5 = [11, 22, 33, 44, 55];
const result = _.zip(arr1, arr2, arr3, arr4, arr5)
console.log(result)
Menu