我有一个多维数组,它看起来像这样:
[
["1","2","3","4"],
["1","2","3","4"],
["1","2","3","4"],
["1","2","3","4"]
]
我希望能将数组中每个元素按照其下标相加,并将结果放入一个新的数组中。 期望得到的结果:
[4,8,12,16] //(adding the 4 array values with appropriate index)
我发现Lodash有一个
_.zip
方法,但是它不接受数组的数组作为输入以获得正确的值。是否有一种简单的方法来实现这一点?