Why is this array out of index?

前端 未结 2 870
萌比男神i
萌比男神i 2021-01-27 17:02

I am trying to sort elements into a two dimensional array I built this way, but when the code gets to the 2D array I get an error: \"array out of index\".

var ca         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-27 17:48

    You should initialize the [i]th element before than appending some [j]th element to it.

    You would call the append() function on an item that does not exist, since no item exists in the categoryTempArray array, thus the index out of bound.

提交回复
热议问题