fcsm_andrei,
let arr = [[1, , 3, 4, 5, ], [, 2, 3, 4, 5 ,234, ], [, , , ]];
function f(c) {
return c.reduce(function(b, a) {
Array.isArray(a) ? (a = f(a), a.length && b.push(a)) : void 0 !== a && b.push(a);
return b;
}, []);
};
let c = f(arr);
console.log(c)