So, I wrote my code, manually checked all cases from the task - and even though each of them returned what it should, every single tasks was marked with an x and i simply dont know why ( i know it ‘may’ not be best quality code )
the slice() method may be better than the splice() method so that you are not modifying the original array itself when you extract the values. But to use the slice() method, you would then need to modify your code to slice from the end using negative index.