not sure I understand what you say but `["maria",
"marianne"].some(str.contains,
str)` means `["maria", "marianne"].some(function (value) {return
this.contains(value)}, str)` ... no bind nor arrow function needed, the
function `str.contains` is executed with `str` as context per each
iteration. Is that confusing? 'cause that's how
some/every/forEach/map/filter work

On Tue, Mar 10, 2015 at 10:18 PM, Garrett Smith <dhtmlkitc...@gmail.com>
wrote:

> On 3/10/15, Andrea Giammarchi <andrea.giammar...@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
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to