2048
登录
没  有  难  学  的  前  端
登 录
×
<返回上一级

js怎么将一个二维数组转换成对象?

javascript作者:猿2048志愿者

二维数组的格式如下:

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

要求将使用索引为0的每一项作为key值,
后面对应的位置的字符作为value。

输出的格式为:

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

求助,该这么转换啊?

先感谢。


clipboard.png

评论
点击刷新
评论
相关问题
×添加代码片段