Not quite impossible, you just have to get a bit creative. While certainly not as fast as a built in implementation, the method used here is still O(1). https://github.com/Benvie/ES6-Harmony-Collections-Shim
> The major use case for Maps and Sets (as far as i'm concerned) is the > ability to use objects as keys. Having built-in implementation of these > potentially enable O(1)-ish lookups (which is impossible to implement in > JavaScript). > As to Maps and {} being equivalent, that's true expect when it's not, like > when you want to use pseudo properties like __proto__ or __noSuchMethod__ > as keys. Some folks tried to use objects as maps and got burned [1]. See > Caja's StringMap [2] for a workaround when you only need strings as keys. > > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss