please add orEqual operator

Andrea Giammarchi andrea.giammarchi at
Mon Aug 10 17:56:20 UTC 2015


On Mon, Aug 10, 2015 at 6:15 PM, joe <joeedh at> wrote:

> I actually like `[1, 2, 3, 4, 5, 6].contains(a)` better, too.  The
> question is, will engines actually optimize it.
if the entire environment never touches even "by accident" the
`Array.prototype` I don't see why that couldn't be optimized by the engine
... but in general, if a *small* `Array#contains` is the performance
 bottleneck of any application I think there's probably something else
wrong there, or maybe the only better performance approach would be a
`switch` with all cases well defined with a `break` (as someone somewhere
suggested once about a speedy subset of JS)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list