Non-standard Array generics have been deprecated

Published: | Categories: JavaScript


The non-standard, Firefox-specific Array generic methods, introduced with JavaScript 1.6, are now considered deprecated and will be removed in the near future. These generic/static methods include:

  • Array.concat
  • Array.every
  • Array.filter
  • Array.forEach
  • Array.indexOf
  • Array.join
  • Array.lastIndexOf
  • Array.pop
  • Array.push
  • Array.reduce
  • Array.reduceRight
  • Array.reverse
  • Array.shift
  • Array.slice
  • Array.some
  • Array.sort
  • Array.splice
  • Array.unshift

Here are some alternatives to the generics:

// Deprecated
Array.forEach(obj, callback);
// Alternative 1: the spread syntax
// Alternative 2: the Array.from method
// Alternative 3: the old-school way
// (if the object is not yet iterable), callback);

Note that the standard instance methods on Array.prototype won’t be affected, of course. The following static methods are also in the ECMAScript 2015 (ES6) spec and therefore they won’t be removed:

Note that String generics have already been removed with Firefox 68.

Update: Array generics have been disabled in the Nightly channel as of Firefox 70.