On Fri, Nov 2, 2012 at 12:29 PM, Domenic Denicola < dome...@domenicdenicola.com> 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. -j
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss