I don't have the data to back this up, but I would argue that the developer community has essentially adopted `Array.isArray()` as a sane replacement for `Object.prototype.toString.call(maybeArray) === '[object Array]'`.
I realize this forum doesn't have the luxury of *not* considering the nuances between a value having the right [[Class] property vs. having Array.prototype in the chain vs. having an exotic length property, etc., but I would at least suggest that the consumers of `Array.isArray()` are largely just concerned with whether or not they can do everything with a particular value that they could do if it were an actual array, while maintaining equal code semantics. Allen's previous comments: Proxies are not transparent forwarders! In particular their default > handling of the `this` value on method invokes will break any built-in > method that needs to access "internal slots" of an object. ...lead me to believe that this isn't the case for proxified Arrays, so I'd have to reverse my earlier position, as `Array.isArray(proxifiedArray)` evaluating to true just seems likely to break code. On Fri, Nov 14, 2014 at 3:36 PM, Brendan Eich <[email protected]> wrote: > Tom Van Cutsem wrote: > >> >> No really, it was a way to expose a test of the [[Class]] internal >> property. That test wasn't dependent upon the [[Prototype]] chain. >> >> >> I think what Domenic was saying is that Array.isArray used such a test >> *because* instanceof Array didn't work reliably cross-realms. I too vaguely >> recollect that reliable cross-realm "instanceof Array" testing was a >> primary motivation for Array.isArray. >> > > Yes, that was Crock's stated motivation as I recall. Here's a 2003-era > post from Doug: > > https://groups.google.com/forum/#!msg/comp.lang.javascript/XTWYCOwC96I/ > 70rNoQ3L-xoJ > > /be > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > -- Jeremy Martin 661.312.3853 http://devsmash.com @jmar777
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

