3 ms·
> Too bad they didn't just let objects take anything as a key They do, except they get coerced to strings in whacky ways. Objects can be used largely like arra
by gnode 7y ago
> Too bad they didn't just let objects take anything as a key
They do, except they get coerced to strings in whacky ways. Objects can be used largely like arrays, and Arrays are Objects, but Array is more suited for an ordered collection of numerically indexed elements, and so has relevant properties and methods, like length and indexOf.
- dlbucci 7y agoYeah, but the weirdness inherent to them being objects but also not objects leads to all sorts of bullcrap, like `Array.isArray` being a thing. I greatly prefer the Lua approach where you only have one map type (tables), and there are methods that allow you to easily use the tables as an array.