Accepting an array as the first parameter to String.prototype.includes

Garrett Smith dhtmlkitchen at gmail.com
Tue Mar 10 22:18:19 UTC 2015


On 3/10/15, Andrea Giammarchi <andrea.giammarchi at gmail.com> wrote:
> contains better than indexOf ? I'd agree only if contains wasn't accepting
> any extra argument, which makes it even more (pointless?) similar to
> indexOf.
>
> If it had only one incoming parameter, you could have `["maria",
> "marianne"].some(str.contains, str)` and win over all other examples. but
> just the `!=-1` or `>-1` as reason to prefer contains? ... dunno, I think I
> have 99 problems in JS related development, `>-1` ain't one :-/
>

Evidently.

I can only guess that str is a string. Strings don't have a contains
method, nor was one proposed the call str.contains(str) inside of a
call to some looks like a confused mistake.
-- 
Garrett
@xkit
ChordCycles.com
garretts.github.io
personx.tumblr.com


More information about the es-discuss mailing list