function fn (arr) {
var mas = [];
for(var i = 0; i < arr.length; i++) {
if(Array.isArray(arr[i])) mas = mas.concat(fn(arr[i]));
else mas.push(arr[i]);
}
return mas;
}
var f = fn([5, [2, 8, [35, 48, [24]], 15, [12, 85]], [[1, [34, [26]], [15]]]])
alert(f)