On Wed, 2011-02-23 at 18:45 +0300, Dmitry A. Soshnikov wrote:
> http://dev.opera.com/articles/view/javascript-array-extras-in-detail/
I would take issue with the “Generic nature” section here. The examples
chosen to illustrate it are exactly the two cases where you *shouldn't*
use Array methods generically:
Array.prototype.map.call("hello world", function (char) { ... });
relies on the feature of Array-like character access for String, which
is a requirement for ES5 but not in ES3. Hence it fails on IE7 and other
older browsers even if you define your own implementation of
Array.prototype.map.
> We can also call a method of an array for the DOM nodes collection
Nope: Array.prototype.* are only defined to work generically for native
JS objects, not host objects. This too will fail in IE7 and other
non-modern browsers.
--
And Clover
mailto:[email protected] http://www.doxdesk.com
skype:uknrbobince gtalk:[email protected]
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]