JavaScript 对象中的属性数量是否有限制? [英] Are there limits to the number of properties in a JavaScript object?
本文介绍了JavaScript 对象中的属性数量是否有限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们有一个拥有超过 75000 个属性的对象.对象的格式如下:
We have an object with more than 75000 properties. The format of the object is as following:
// The key starts with 3 letters and then is followed by 8 numbers
var bigArray = {'AAA########':123456789,
'AAA########':123456790,
'AAA########':123456791
};
JavaScript 对象的属性数量是否有已知限制?根据我的测试,该对象在 65500 个元素上仍然有效.
Is there a known limit of the quantity of properties for JavaScript objects? From my tests the object still works at 65500 elements.
- 在 Windows 7、IE9 中,脚本崩溃(错误 -2147024882).
- Windows XP、IE8 运行良好.
推荐答案
从我们对这个问题的测试来看,IE9、Windows 7 似乎将 HTA 脚本中的行数限制为 65535.我没有找到任何来源问题,这只是我们测试的结果.
From our test on this issue it seems that IE9, Windows 7, limits the number of line in a HTA script to 65535. I did not find any source on the issue, it is just the results of our tests.
这篇关于JavaScript 对象中的属性数量是否有限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文