Javascript making map access fast
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 = [];
精彩评论