Well, as it turns out, -1 is already a valid key. Arrays are really objects with indices as keys. So arr[-1] is looking at the arr object and the value of the "-1" key, which is undefined.
There can be a "-1" key present in the object, so the behaviour for "negative indices" is already defined by the language.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The article covers this really:
There can be a "-1" key present in the object, so the behaviour for "negative indices" is already defined by the language.