我想将 2D JavaScript 数组转换为 1D 数组,以便将 2D 数组的每个元素连接成一个 1D 数组。
在这里,我正在尝试转换arrToConvert
为一维数组。
var arrToConvert = [[0,0,1],[2,3,3],[4,4,5]];
console.log(get1DArray(arrToConvert)); //print the converted array
function get1DArray(2dArr){
//concatenate each element of the input into a 1D array, and return the output
//what would be the best way to implement this function?
}