function splits(arr, num) { return [arr.splice(0, num), arr]; } console.log(splits([1, 2, 3, 4, 5], 4));