How would you define Array.isArray on the Array prototype? That'd just fail
for everything that is not an array and doesn't implement isArray itself.

Things like Object.keys are reflective, enumerating over the properties of
an object (even more so in ES6) is not something you'd commonly do in the
'application level'. We have `Map`s now :)

Benjamin


---------- Forwarded message ----------
From: Oliver Joseph Ash <[email protected]>
To: [email protected]
Cc:
Date: Mon, 16 Dec 2013 23:24:31 +0000
Subject: ES5/ES6 methods on constructor functions instead of prototype
I'm noticing that many methods added in ES5 and due in ES6 are defined on
the type's constructor function instead of on the type's prototype. For
example, Object.keys, Object.defineProperty, and Array.isArray.

Is there a reason these were not added to the prototype, i.e.
Object.prototype.keys, for consistency?

Best,
Oliver
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to