One liner for swapping vars in Javascript
Snippet
Yeah, kitt finished writing this at 15:45 on 22 September 2015
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