Array Processing
Arrays are one of the most fundamental data structures in any imperative programming language, including JavaScript. Unfortunately, however, standardized array operations are not supported by all mainstream browsers, and as long as that is the case, it's immensely helpful to have a toolkit that protects you from the bare metal. For that matter, even if the next version of each major browser supported arrays in a completely uniform manner, there would still be way too many people out there using older browsers to begin thinking about going back to the bare metal anytime soon.
Tip
You may find it interesting that the various language tools
have been optimized for performance, providing wrapped usage of the
native Array implementations
wherever possible, but emulating functionality for browsers like IE
when it is missing.
Fortunately, Dojo strives to keep up with Mozilla's feature rich
implementation of the Array object
(http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference).
As long as you have the toolkit with you, you'll never be caught
defenseless again. And in case you have already forgotten from our
discussion of dojo.byId in Chapter 1 that you really can't take much for
granted in the current browser ecosystem, the next section should
reinvigorate your enthusiasm and might even surprise you.
Finding Locations of Elements
Two very routine array operations involve finding the index of an element, which is really one and the same as determining if an element ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access