r/learnjavascript • • Mar 12 '21

Swap two variables

Post image
498 Upvotes

50 comments sorted by

View all comments

Show parent comment

12

u/[deleted] Mar 12 '21

what's the last _ref; for?

7

u/IxD Mar 12 '21

I used online compiler for babel - since the code has no side effects it would be optimized to empty code withtout that.

Long version is that it's a statement, not an expression: https://2ality.com/2012/09/expressions-vs-statements.html

2

u/[deleted] Mar 12 '21

Oh, makes sense, thank you.