Ranges are usually specified with the lower bound being inclusive and the upper bound exclusive. In this case [fromIndex, toIndex)
So if the range goes to the end of the arrary, then you would expect toIndex == arrayLen and the check is correct.
So if the range goes to the end of the arrary, then you would expect toIndex == arrayLen and the check is correct.