I also ran through your code and found out a solution with some more code.
There’s one thing to notice about your code that I think gets frowned upon by more experienced designers. You have arr.length in the termination condition for the ‘for loop’. However, you keep splicing that arr, and thus the value of arr keeps changing. So, what to do?
I would suggest that you make a clone of arr and then use that for your upper bound. By ‘clone of arr’, I mean a copy of arr that doesn’t get change when you change arr. Actually, it’s probably less code to find the value of arr.length before the computer would compute the ‘for loop’, store it as a constant, and then execute the ‘for loop’.
When do you want the computer to return tempArr? I ended up writing a conditional for that, but I suggest you think about that.
Also, there’s another way to solve this problem without using slice at all. The first time I solved it, and it’s not a more efficient solution, I first wrote a helper function to create an array of empty arrays. Then I called that function on the ceiling of the ratio of the length of the array and size. So, if the ratio was 2.5, I’d have an array like [[], [], []]. Then I pushed each number from the original array into the appropriate subarray. My function had two for loops though, so on average it would end up slower than the track that you’re on.