Push operator into assignment

Move an operator from a binary expression into an assignment operator, e.g., +=.

Push operator into assignment

Why is this refactoring helpful?

Moving an operator into the assignment is a more concise notation that emphasizes that a variable is modified with an update relative to its current value.

What do I need to consider?

Logical Assignment Operators (&&=, ||= and ??=) are an ES2021 feature. They are supported on all modern browsers and on Node 15+, and but for older browsers and Node versions transpilation might be required (compatibility).


Related Code Assists

Learn More

Available In