Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

Tom Van Cutsem tomvc.be at gmail.com
Sun Nov 16 23:08:06 PST 2014


2014-11-17 3:34 GMT+01:00 Frankie Bagnardi <f.bagnardi at gmail.com>:

> Consider when Array.isArray would be used.  In my experience, checks to
> see if something is an array are used for:
>
>  - deciding how to iterate it (for(;;) vs for..in, for example)
>

This is a good one. Here, again, a typical proxy-for-array would work as
intended, as the for(;;) loop just queries .length and properties named
"0", "1", ... via standard [[Get]] access.

Can someone come up with a convincing example where a proxy-for-array would
*not* work as intended?
("convincing" here means it doesn't involve a proxy that blatantly violates
the Array contract on purpose)

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141117/630bc9d5/attachment.html>


More information about the es-discuss mailing list