See Stage 3 Logical Assignment Proposal.
https://github.com/tc39/proposal-logical-assignment

Thanks.
2020年4月13日 18:17 +0900、Sultan <[email protected]> のメール:
> The following would assign to the address foo in obj if and only if it has 
> not already been assigned.
>
> var obj = {}
> var foo = Math.random()
> obj[foo] ?= 1
>
> The same can be said for:
>
> var undef
> undef ?= 1
>
> Which could both be transpired to
>
> type obj[foo] === 'undefined' && obj[foo] = 1
>
> or
>
> type a === 'undefined' && undef = 1
>
> respectively.
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to