On 18 Dec 2013, at 23:02, Benjamin (Inglor) Gruenbaum <ing...@gmail.com> wrote:

> If anything, I'd expect all of them to throw when passed multiple arguments 
> for forward compatibility. It might be useful to check multiple values in 
> contains/endsWith/startsWith or constrain it in some way. 

The reason `String.prototype.{starts,ends}With` throw when passed a regular 
expression is forward compatibility:

> Note 2. Throwing an exception if the first argument is a RegExp is specified 
> in order to allow future editions to define extends that allow such argument 
> values.

It seems that `contains` was forgotten about when 
https://bugs.ecmascript.org/show_bug.cgi?id=498#c3 was fixed, so I’ve filed 
https://bugs.ecmascript.org/show_bug.cgi?id=2407 asking to make 
`String.prototype.contains(regex)` throw as well.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to