Rick Waldron waldron.rick at
Fri Nov 2 11:04:52 PDT 2012

On Friday, November 2, 2012 at 1:56 PM, Jason Orendorff wrote:

> On Fri, Nov 2, 2012 at 12:29 PM, Domenic Denicola <domenic at (mailto:domenic at> wrote:
> > > If we call it "has", should we also rename String.prototype.contains?
> > 
> > I'd say no; the distinction between collections "having" an element and strings "containing" a substring seems very sensible. It's a bit more awkward to say a string "has" a substring, and a string is definitely not a collection of substrings in any reasonable sense.
> Well, you could also note that array.has(x) looks for a particular value, while map.has(x) looks for a particular key.
> But that's not the point. There's no common formal contract implemented by all these methods; what they share is an informal "hey, look in this thing, and tell me if you see that thing" vibe.
> I like the idea of being able to say str.has(",") or str.has("=>") or str.has("@jorendorff") and have them all just work.
This is definitely nice :)

Jason, Erik, Mark,

Any specific thoughts about the SameValue case as it likely doesn't apply to a hypothetical String.prototype.has impl.? I suspect that a string had would still use indexOf which would introduce an internal inconsistency for the sake of API consistency (which I'm all for). Unless I'm overlooking?

> -j
> _______________________________________________
> es-discuss mailing list
> es-discuss at

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

More information about the es-discuss mailing list