There are a few ways to swap two variables without using a temporary variable:
[a, b] = [b, a];
// Or
a = [b, b = a][0];
// Or
a = (x => x)(b, b = a);If both variables are numbers, then you can swap them with operators:
a = b + (b = a, 0);
// Or
a = b * (b = a, 1);