-1
A
回答
0
几种方法达到的效果
var data = [
[5],
[27],
[39],
[1001]
];
// Use map method which iterate over the array and within the
// callback return the new array element which is first element
// from the inner array, this won't work if inner array includes
// more than one element
console.log(
data.map(function(v) {
return v[0];
})
)
// by concatenating the inner arrays by providing the array of
// elements as argument using `apply` method
console.log(
[].concat.apply([], data)
)
// or by using reduce method which concatenate array
// elements within the callback
console.log(
data.reduce(function(arr, e) {
return arr.concat(e);
})
)
相关问题
- 1. 如何将数组数组的数组合并到一个数组中?
- 2. 如何将数组合并到一个多维数组中?
- 3. 如何将数组数组合并成一个数组?
- 4. 如何将多个数组组合到一个新数组中?
- 5. 如何将对象数组值组合到一个数组中?
- 6. 将数组合并到主数组中
- 7. 将两个数组合并到一个数组中
- 8. 我如何将数组值合并到单个数组中?
- 9. 将这些数组值合并到一个新的数组中?
- 10. 拿一个数组并将它组合成另一个数组
- 11. 如何将2个数组合并成一个数组?
- 12. 如何将两个数组合并成一个数组?
- 13. SystemVerilog:如何将2个数组合并成一个数组?
- 14. 将多维数组合并到另一个多维数组中
- 15. 将数组合并到另一个数组中
- 16. Codeigniter将数组合并到一个数组中
- 17. PHP数组从一个数组合并到另一个数组中的值
- 18. 如何将数组的值合并到多维数组中?
- 19. 如何将数组数组合并成一个php
- 20. 如何将这些数组合并成一个数组?
- 21. 在PHP中将五个数组合并到五个“组合”数组中
- 22. 将javascript数组键合并到内部数组中?
- 23. 将二维数组合并到组中
- 24. 如何将单个数组组合为一个二维数组?
- 25. 如何将数组变量合并到对象数组中?
- 26. 如何将数组合并到2d数组中php
- 27. C++将2d数组(合并为uniqe_ptr)合并到3d数组中
- 28. 将值合并到一个数组
- 29. 如何在PHP中将数组分组到一个数组中?
- 30. 如何将数组组合到Mysql中
到目前为止,你已经尝试过什么? –
子数组是否可以包含多个元素?他们自己可以包含子子数组吗? – 2017-02-25 18:11:41