Splice challenge

Why does TypeError: arr[i] is undefined appear? - here there is an error and in this splice challenge which has the same syntax there isn’t; i’m wondering why; thank you for your interest