Rick Waldron (2011-12-30T22:28:28.000Z)
On Fri, Dec 30, 2011 at 5:24 PM, Jason Orendorff
<jason.orendorff at gmail.com>wrote:

> On Fri, Dec 30, 2011 at 6:58 AM, Xavier MONTILLET
> <xavierm02.net at gmail.com> wrote:
> > http://wiki.ecmascript.org/doku.php?id=harmony:string_extras
> > 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.
>

At this.indexOf ? Or the whole "this.indexOf(x) !== -1;" lookup? How else
could it work?

Rick


>
> -j
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111230/e5fb6458/attachment.html>
domenic at domenicdenicola.com (2014-03-06T22:10:17.197Z)
> except without the property lookup for indexOf.

At `this.indexOf` ? Or the whole `this.indexOf(x) !== -1;` lookup? How else could it work?