Map an array of arrays

后端 未结 6 1842
太阳男子
太阳男子 2021-02-07 02:17

Is there a method in lodash to map over an array of arrays

I would like to do something like this so that it keeps the structure of the array.

def double         


        
6条回答
  •  时光取名叫无心
    2021-02-07 02:54

    It's much more elegant to use the es6 destructuring syntax within your map statement:

    array.map(([ a, b ]) => [ a*2, b*2 ]);
    

提交回复
热议问题