Jason Orendorff jason.orendorff at
Fri Dec 30 14:24:50 PST 2011

On Fri, Dec 30, 2011 at 6:58 AM, Xavier MONTILLET
< at> wrote:
> There is a proposal for String.prototype.contains so why can't I find
> one for Array.prototype.contains?

No kidding. I need this method every time I write ECMAScript code.
What I want is like:

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

except without the property lookup for indexOf.


More information about the es-discuss mailing list