Extra functions on Arrays, Maps, etc..
domenic at domenicdenicola.com
Sat Apr 7 17:41:50 PDT 2012
On Apr 7, 2012, at 20:37, "Rick Waldron" <waldron.rick at gmail.com<mailto:waldron.rick at gmail.com>> wrote:
On Sat, Apr 7, 2012 at 8:31 PM, Erik Arvidsson <erik.arvidsson at gmail.com<mailto:erik.arvidsson at gmail.com>> wrote:
On Sat, Apr 7, 2012 at 17:28, Rick Waldron <waldron.rick at gmail.com<mailto:waldron.rick at gmail.com>> wrote:
> As in, its [[Class]] is "Array" and Array.isArray( nodes ) would evaluate to
No, it means that Object.getPrototypeOf(NodeList.prototype) === Array.prototype.
Yes, this part was clear in the links you sent. The question I had was about two things that were not addressed in the links (that I could see, please correct if I missed them)
There will be much confusion on the web if Array.isArray(nodes) returns false, while nodes.push( node ), nodes.slice( 0, 2 ) "just work", especially during periods of transition from DOMx to DOM4.
Fortunately all the Array.prototype methods are generic so it all just works.
I think the benefits are so great I'm happy to deal with any confusion.
Although, it sounds like I'll be wanting to go back to `instanceof Array`, which is kind of funny.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss