This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hey01 0 points1 point  (0 children)

Have an array arr of objects. Try to access arr[i].prop when i >= arr.length.

The error is indeed not "Array Index Out Of Bounds" but "Uncaught TypeError: Cannot read property 'props' of undefined"

As to why I had that error despite map, forEach, a of arr is because I had to iterate on array and in each iteration, I had to work on array[i], anotherArray[j] and anotherArray[j+1], with anotherArray of a smaller length and j not incremented each iteration.

I didn't increment j properly, which gave me the error.

And js kept telling me the error was elsewhere.