Array.prototype.contains

Domenic Denicola domenic at domenicdenicola.com
Fri Nov 2 10:29:19 PDT 2012


-----Original Message-----
From: es-discuss-bounces at mozilla.org [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Erik Arvidsson
Sent: Friday, November 2, 2012 13:21

> 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.

If anyone had proposed String.prototype.has(singleCharOrMaybeCodePoint), then perhaps that name would make sense.



More information about the es-discuss mailing list