开发者

Javascript making map access fast

开发者 https://www.devze.com 2023-02-10 04:25 出处:网络
Map size is around 2000 elements. When acces开发者_如何学运维sing the map with key\'s it works good on chrome but firefox crashes sometimes. Is there a way to map the access fast. I am using jQuery to

Map size is around 2000 elements. When acces开发者_如何学运维sing the map with key's it works good on chrome but firefox crashes sometimes. Is there a way to map the access fast. I am using jQuery too.

var map=new Object();
map[1] =blah;
..
map[3000] =blah3000;

access randomly any element. What would be an optimal solution?


A 2000 item array? Sounds like what yous should be asking is ideas to reengineer whatever functionality you're trying to achieve.


Try to change Object to Array, like this:

var map = [];
0

精彩评论

暂无评论...
验证码 换一张
取 消