Maximum size of an Array in Javascript

前端 未结 7 1903
我在风中等你
我在风中等你 2020-11-22 10:46

Context: I\'m building a little site that reads an rss feed, and updates/checks the feed in the background. I have one array to store data to display, and another which stor

7条回答
  •  天命终不由人
    2020-11-22 11:22

    The maximum length until "it gets sluggish" is totally dependent on your target machine and your actual code, so you'll need to test on that (those) platform(s) to see what is acceptable.

    However, the maximum length of an array according to the ECMA-262 5th Edition specification is bound by an unsigned 32-bit integer due to the ToUint32 abstract operation, so the longest possible array could have 232-1 = 4,294,967,295 = 4.29 billion elements.

提交回复
热议问题