One liner for swapping vars in Javascript
Snippet
Written with a loving hand by kitt some time around 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