Does JavaScript have an implementation of a set data structure?
问题 I'm looking for a decent implementation of a set data structure in JavaScript. It should be able to support elements that are plain JavaScript objects. So far I only found Closure Library's structs.Set, but I don't like the fact that it modifies my data. 回答1: You could build a simple wrapper around the keys of a hash table provided by my jshashtable. I have one knocking around somewhere that I will dig out later. UPDATE I have completed and tested an implementation of HashSet and uploaded it