Array.size() vs Array.length

后端 未结 10 830
一个人的身影
一个人的身影 2020-11-28 01:17

What is the difference between the two?

So I know that array.size() is a function while array.length is a property. Is there a usecase for

10条回答
  •  粉色の甜心
    2020-11-28 02:10

    .size() is not a native JS function of Array (at least not in any browser that I know of).

    .length should be used.


    If

    .size() does work on your page, make sure you do not have any extra libraries included like prototype that is mucking with the Array prototype.

    or

    There might be some plugin on your browser that is mucking with the Array prototype.

提交回复
热议问题