Normally languages which provide associative arrays also build in
routines to list the keys, the values or both from an instance of these
attributes with a
for/in loop, but that’s a bit like using a
hammer to repair a watch, which is an analogy that also holds for parsing
query strings in URLs with JS. What a nightmare. It’s always 1996 in
Classes without an inheritence mechanism are like pants without bottoms and only David Lee Roth could get away with wearing assless pants.
Another consequence of not having classes is that you can never find out
what kind of Object you’re dealing. That is, you can’t ask an object,
“what class do you belong to, little fella?” The confused bastard will
answer “I’m an Object Object,” which sounds a little desperate — like the
JS object really wants you to believe it’s a first class object, which
it isn’t. This reminds me of a common folklore tenet in which all things
have a Truename that, if uttered, will give the speaker power over that thing.
Are JS objects superstitious? It’s true you can “override” (or overwrite)
.toString method with something about the class name, but
Anyway, why bother with class heirarchies? Most JS scripts last only a short while and have so limited a scope. Then again, why bother pretending to have objects at all? Let’s call a hash “a hash” and be done with it.
Classless classes are the assless pants of the Internet.