please add orEqual operator
myemailum14 at gmail.com
myemailum14 at gmail.com
Mon Aug 10 01:50:45 UTC 2015
Isn't
prop ||= 0;
better than
prop = prop || 0;
and it can be even defined like this.
prop ||= var1 ||= var2 ||= 0;
but then i dont know how we can use it ike this
if (num == 3 ||=4 ||=6)
On Sun, Aug 9, 2015 at 9:47 PM, <myemailum14 at gmail.com> wrote:
> why create an array when there can be an operator. I think if we do survey
> people will like this, ||=, it's more expressive.
>
> On Sun, Aug 9, 2015 at 9:41 PM, Isiah Meadows <isiahmeadows at gmail.com>
> wrote:
>
>> Or, there is the likely ES7 Array#contains for comparing multiple numbers.
>>
>> ```js
>> [1, 2, 3].contains(value);
>> ```
>>
>> As for the operator proposed here, there's already an existing proposal
>> for a safer version which doesn't coerce:
>> http://wiki.ecmascript.org/doku.php?id=strawman:default_operator.
>>
>> On Sun, Aug 9, 2015, 19:02 Michael A. Smith <michael at smith-li.com> wrote:
>>
>>> I was going to suggest a Set, now that ECMA has them…
>>> http://www.ecma-international.org/ecma-262/6.0/index.html#sec-set-objects
>>>
>>> ```js
>>> if ((new Set([1,2,3,5]).has(a)) {
>>> // stuff
>>> }
>>> ```
>>>
>>>
>>>
>>>
>>> On Sun, Aug 9, 2015 at 4:20 PM <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
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> es-discuss at mozilla.org
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150809/0b75dad3/attachment-0001.html>
More information about the es-discuss
mailing list