How does js convert a two-dimensional array to an object?

the format of the two-dimensional array is as follows:

[["num1","num2","num3","num4"],["1","2","3","4"],["1","2","3","4"],["1","2","3","4"],["1","2","3","4"]];

requires that each item with an index of 0 be used as the key value and the character in the corresponding position after
as the value.

the format of the output is

{
    num1:["1","1","1","1"],
    num2:["2","2","2","2"],
    num3:["3","3","3","3"],
    num4:["4","4","4","4"]
}

ask for help, should you change it this way?

< H2 > Thank you first. < / H2 > < hr >

clipboard.png



,

    const crr=[["num1","num2","num3","num4"],["1","2","3","4"],["1","2","3","4"],["1","2","3","4"],["1","2","3","4"]];
    const drr=crr.reduce((pre,cur,i,arr)=>{
        if(i===4) return pre
        pre[arr[0][i]]=arr.reduce((pre1,cur1,j)=>{
            if(j===0) return pre1
            return pre1.concat(cur1[i])
        },[])
        return pre
    },{})
    console.log(crr,drr)
Menu