David Bruant bruant.d at
Wed Mar 5 01:07:58 PST 2014

Le 05/03/2014 09:24, Eric Elliott a écrit :
> What ever happened to Array.prototype.contains? There's an old 
> strawman for Array.prototype.has ( 
> ) 
> that references this thread: ( 
> )
Let's try to add it to the next meeting agenda

> But it seems the thread fizzled out a couple years ago, and 
> Array.prototype.contains didn't seem to make its way into ES6. That 
> seems odd, since we do have String.prototype.contains, and it seemed 
> like it was desirable for DOM.
The DOM won't inherit from it directly, shall it?

> It's also a standard utility function in several libraries.
> Was it left out on purpose? If so, what was the justification?
> I predict code like this without it:
> ''[1,2,3],2);// true
.indexOf === -1 works today for this use case and will continue to.
I'd be happy to see !~arr.indexOf(el) disappear in favor of a use of 
.contains() though.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list