Array.prototype.includes with multiple arguments

Shahar Or mightyiampresence at gmail.com
Fri Jun 10 22:07:16 UTC 2016


On Sat, Jun 11, 2016 at 12:01 AM Oriol Bugzilla <oriol-bugzilla at hotmail.com>
wrote:

> Array.prototype.includes uses the second argument as the starting index.
>
> Therefore, these calls would be identical, but you want them to behave
> differently:
>
> ```
> ["a"].includes("a", 0); // true -- "a" can be found at position 0
> ["a"].includes(...["a", 0]); // false -- 0 can't be found in the array
> ```
>
> So no, it wouldn't work well. Moreover, why every and not e.g. some?
>
> But maybe new methods could be added, like includesEvery and includesSome.
>

Right. I should've checked that. Yup, `.includesEvery` and `.includesSome`
seem nice. I would call the latter `.includesAny`, I think.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160610/bda27482/attachment.html>


More information about the es-discuss mailing list