Login Register

Array manipulation functions

Like Dojo 0.4.x, Dojo 0.9 provides portable implementations for many of the JavaScript 1.6 Array functions not provided by some browsers. Unlike previous versions, however, these are now top-level functions on the Dojo object. These methods are available but have been moved from dojo.lang:
  • dojo.forEach()
  • dojo.some()
  • dojo.every()
  • dojo.map()
  • dojo.indexOf()
  • dojo.lastIndexOf()
  • dojo.filter()
Earlier versions of some of these methods supported non-standard extensions to JavaScript 1.6. This is no longer the case in Dojo 0.9. The Mozilla Developer Guide reference regarding how the various methods should work is now the reference for our methods, modulo passing in the array as the first parameter. The following methods are being entirely removed:
  • dojo.lang.find(), use dojo.indexOf()
  • dojo.lang.findLast(), use dojo.lastIndexOf()
  • dojo.lang.has()
  • dojo.lang.inArray()
  • dojo.lang.isEmpty()
  • dojo.lang.reduce()
  • dojo.lang.toArray()
  • dojo.lang.unnest()