One liner for swapping vars in Javascript
Snippet
kitt decided around 15:45 on 22 September 2015 to publish this:
You can swap two variables in javascript like every other language: by using an intermediate variable. OR! You can have a one liner.
Love me those one liners!
b = [a, a = b][0];
Source:
Add new comment