I seem to remember that arrays in JavaScript are in theory just objects/dicts such that:
var a = [1, 2, 3];
is equivalent to var a = {0 : 1, 1: 2, 2: 3};
and whatever function is invoked by evaluating `a` in the console must just iterate over the sorted keys of the object, starting at key = 0 and attempting to print key + 1 until the key does not exist. So he may be setting `a[-1]` and it happily exists, but the confusion is just down to the whatever the equivalent of the `__repr__` function is for JavaScript arrays.