Add a Number to Two Variables At Once

PHOTO EMBED

Fri May 01 2020 11:34:52 GMT+0000 (Coordinated Universal Time)

Saved by @AngelGirl #javascript

 foo += -bar + (bar += 5);
// foo and bar are now 15
                                
content_copyCOPY

The -bar gets parsed and becomes the negative value of bar, so -10. Then, a += 5 runs and sets bar to 15 (10 + 5). Finally, it sums up both values (-10 + 15) and gives you the difference between old bar and new bar, which is 15.

https://css-tricks.com/snippets/javascript/add-number-two-variables/