I imagine someone could develop a toolkit that scans for exploitable usage of eval, and use sophisticated engine to find an actual way of exploiting it ?
Since you can arbitrarily add members to an object in Javascript, arrays are implemented by simply adding members. When you want to index a particular element in the array, Javascript converts your numeric index to a string, and accesses the member corresponding to that string.
So they're not really arrays. They're more like hash maps, and have the same performance characteristics as a sparse array.
It's a weird language, in some ways. And a brilliant language in others.
I was trying to come up with an example of a case where you have a function that takes a function as a parameter, which in turn takes (another?) function as a parameter.
For people who have implemented a toy scripting language runtime (without knowing any language theory! no nothing!) javascript's design should be plain obvious.