Yes I like syntactic sugar when it doesn't sacrifice clarity (e.g. class,
arrow functions).
However, I do like the logical assignment operator pointed out by Jordan
somewhat more than the "conditional assign" ("if not assigned") idea at the
beginning of this thread. My reason is that you cannot
Hi!
> What I've long wanted is an assignment operator which evaluates to the
> pre-assignment value of the LHS.
> You know, sort of like `a++` evaluates to the pre-incremented value of `a`.
Given the amount of confusion that the difference between `++a`, `a++`
(and `a += 1`) already has caused,
What I've long wanted is an assignment operator which evaluates to the
pre-assignment value of the LHS.
You know, sort of like `a++` evaluates to the pre-incremented value of `a`.
We could call this this "post-assignment" operator.
Has anyone ever proposed that?
```
let a = 1;
console.log(a =^=
Are you familiar with https://github.com/tc39/proposal-logical-assignment/ ?
On Mon, Apr 13, 2020 at 2:17 AM Sultan wrote:
> 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
See Stage 3 Logical Assignment Proposal.
https://github.com/tc39/proposal-logical-assignment
Thanks.
2020年4月13日 18:17 +0900、Sultan のメール:
> 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()
>
5 matches
Mail list logo