New operator

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

New operator

Sebastian Malton
Since the following is a decently common idiom I propose that we have a self referential version of it.

Idiom:
```js
myVar = myVar || "default" ;
```

New Operator:
```js
myVar ||= "default" ;
```

Sebastian Malton


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: New operator

kdex
Please do some research before posting in the future.

[1] https://esdiscuss.org/topic/or-equal-operator
[2] https://esdiscuss.org/topic/proposing-a-conditional-assignment-or-equals-operator
[3] https://esdiscuss.org/topic/new-assignment-operators-not-bit-wise-or
[4] https://esdiscuss.org/topic/please-add-orequal-operator
[5] https://esdiscuss.org/topic/is-much-needed
[6] https://esdiscuss.org/topic/operators-and
[7] https://esdiscuss.org/topic/logical-assignment-operators

On Tuesday, February 13, 2018 10:05:18 PM CET Sebastian Malton wrote:

> Since the following is a decently common idiom I propose that we have a self
> referential version of it.
>
> Idiom:
> ```js
> myVar = myVar || "default" ;
> ```
>
> New Operator:
> ```js
> myVar ||= "default" ;
> ```
>
> Sebastian Malton
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

signature.asc (849 bytes) Download Attachment