Я хочу преобразовать массив 2D JavaScript в 1D-массив, так что каждый элемент 2D-массива будет объединен в один одномерный массив.
Здесь я пытаюсь преобразовать arrToConvert
в 1D-массив.
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?
}