Is there a common name for the following data structure/pattern?
var o1 = {id:'aaa'}, o2 = {id:'bbb'};
var dataStore = [o1,o2];
dataStore[o1.id] = o1;
dataStore[o2.id] = o2;
So basically, it's an array that also stores its items indexed by a property name. Is there any native js implementation or library that does this with appropriate api (I know it's very easy to implement, just curious).
Aucun commentaire:
Enregistrer un commentaire