please add orEqual operator

Alexander Jones alex at weej.com
Sun Aug 9 22:54:22 UTC 2015


`a ||= b` looks like an in-place logical or, like `+=`.

`a = a || b` would have very different semantics to that which you propose.

In Python this would be written:

```python
if a in [1, 2, 3, 5]:
    # stuff
```

In JS we have similar but slightly less semantic:

```js
if ([1, 2, 3, 5].indexOf(a) > -1) {
    // stuff
}
```

On Sunday, August 9, 2015, <myemailum14 at gmail.com> wrote:

> it could be used like this:
>
> if ( a == 1 ||= 2 ||=3 ||=5) { //do something if a is either 1,2,3,5}
>
> and it could be used like this
>
> a || = 0
> // a = a || 0
>
> thanks
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150809/183f01e5/attachment.html>


More information about the es-discuss mailing list