Теперь работает
function fn (arr, result = [], l = 1) {
let [j, mas, index] = [1*l, arr[0], arr[0].length]
arr.forEach(function (e){j *= e.length;})
for(var i = 0; i < j ; i++)
(result[i] == undefined) ? result[i] = [mas[i%index]] : result[i].push(mas[i%index]);
return (arr.length == 1) ? result : fn(arr, result.sort(), l*arr.shift().length);
}
alert(JSON.stringify(fn([[1,2,3], [4,5,6], [7,8,9]]).sort()))