var all = [];
function one(numbers) {
for (i=0; i<numbers.length; i++) {
if (numbers[i].length) {
one(numbers[i]);
} else {
all.push(numbers[i]);
}
}
return all;
}
var numbers = [1,[6,7],2,3,4,5];
console.log(one(numbers)); // [1, 6, 7, 3, 4, 5]
// нужно // [1, 6, 7, 2, 3, 4, 5]