我需要一个函数,我可以输入具有可变数目的子阵列的数组。 函数应该添加每个位置的子阵列的数量。 这是具有三个子阵列的示例输入阵列(也可以是两个或多个):在javascript中添加可变数组元素的元素
[ [ [ 12 ], [ 8 ], [ 2 ], [ 9 ], [ 2 ], [ 2 ] ],
[ [ 3 ], [ 4 ], [ 2 ], [ 3 ], [ 2 ], [ 2 ] ],
[ [ 6 ], [ 2 ], [ 2 ], [ 3 ], [ 2 ], [ 2 ] ] ]
函数应输出:
[ 21, 14, 6, 15, 6, 6 ]
,你到目前为止做了什么? – trrrrrrm
'function addarrays(){ var outputarray = []; asyncLoop2(arguments.length-2, function(loop){ outputarray = addtwoarrays(arguments [i],arguments [i + 1]); loop.next(); },function(){return outputarray; }); }”“功能addarrays(){ VAR outputarray = []; asyncLoop2(的arguments.length-2, 函数(循环){ outputarray = addtwoarrays(参数[I],自变量[I + 1]); loop.next(); },function(){return outputarray;}); } [这里](http://moourl.com/ai24t)是异步循环功能,我打电话给 –