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, I doubt that would be a good idea.
In most, if not all, cases the desired behaviour can be easier and
cleaner expressed with two statements, and a temporary variable if
absolutely necessary.

> ```
> let a = 1;
> console.log(a =^= 2); // logs 1 and then sets a to 2
> ```

would be just
```
let a = 1;
console.log(a)
a = 2;
```

kind regards,
 Bergi
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to