Erik Arvidsson (2012-02-23T20:15:30.000Z)
DOM4 added a new interface called DOMStringList for the sole reason
that Array does not have contains. Before this the return type was an
Array of Strings so we could use indexOf, map, forEach etc. Now that
it is using a non Array we lost all of that.

Proposal: Add Array.prototype.contains, implemented as:

Object.defineProperty(Array.prototype, 'contains', {
  value: function(value) {
    return this.indexOf(value) !== -1;
  },
  enumerable: false,
  configurable: true,
  writable: true
}{);


This is trivial enough to do in user code but since DOM4 depends on it
we should just put it in the right place; In ES6.

-- 
erik
forbes at lindesay.co.uk (2014-04-07T15:53:12.075Z)
DOM4 added a new interface called DOMStringList for the sole reason
that Array does not have contains. Before this the return type was an
Array of Strings so we could use indexOf, map, forEach etc. Now that
it is using a non Array we lost all of that.

Proposal: Add Array.prototype.contains, implemented as:

```js
Object.defineProperty(Array.prototype, 'contains', {
  value: function(value) {
    return this.indexOf(value) !== -1;
  },
  enumerable: false,
  configurable: true,
  writable: true
}{);
```

This is trivial enough to do in user code but since DOM4 depends on it
we should just put it in the right place; In ES6.