Javascript data structure for fast lookup and ordered looping?
问题 is there a data structure or a pattern in Javascript that can be used for both fast lookup (by key, as with associative arrays) and for ordered looping? Right, now I am using object literals to store my data but I just disovered that Chrome does not maintain the order when looping over the property names. Is there a common way to solve this in Javascript? Thanks for any hints. 回答1: Create a data structure yourselves. Store the ordering in an array that is internal to the structure. Store the