The usual way to swap the values of two variables is usually somethign like this:
var temp = var1; var1 =var2; var2 = temp;
A nifty trick, how to change the values of two variables without using a temporary variable, is the following one liner:
b = [a, a = b];
Credits: I found this neat trick on stackoverflow.