There is nothing in the post that shows that author doesn't know how arrays are represented internally. Moreover, whether or not he does is largely irrelevant. He shows clear examples of bad language design, and they remain such whether you're aware of the inner workings of the language or not.
JavaScript's arrays have issues that span far beyond mere "string representation". For example, you can't safely use for...in construct to iterate over items in an array.
1. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
"Also keep in mind that sometimes I'm playing stupid, but sometimes I'm actually stupid."
I suspect the author knows exactly how arrays work in JS and is just mucking about to demonstrate one of the "Bad Parts". This is pretty much in the same vein as the WAT video (https://www.destroyallsoftware.com/talks/wat)
Indeed JS functions have a special `length' property too, where one can check the # of arguments specified in the function definition.
Try going to http://www.objectplayground.com and putting in the following code, selecting the "Show built-in objects" option, and evaluating:
this.array = [];
this.object = Object.create(Array.prototype);
this.object.push("foo");
this.object.push("bar");
*Well, they sort of work. They use and modify the "length" property, so you could see some weird behavior under some circumstances. Not recommended for production use. :-)
You're correct that arrays are objects, which means they consist key/value pairs. Keys must be strings; values can be anything. So when you say `a[0] = 3;`, JS converts that to `a["0"] = 3;` and stores `{ "0": 3 }`.
So all those "funny" examples the author provides are just variants on converting an expression to a string. For example, `a[typeof a] = 4` is equivalent to `a["object"] = 4` (or `a.object = 4`) because `typeof a` is "object".
There's one wrinkle on this, though: objects and arrays aren't exactly the same thing. Arrays are a special kind of object, as far as JS is concerned. JS maintains a special "length" property for arrays. It doesn't do that for other objects.
(The same applies to JS functions and Regexes. They're objects, but they're special kinds of objects that can do things regular objects can't.)