scroobius-pip
10/3/2016 - 11:11 PM

Swapping values in es6

Swapping values in es6

var a = 1;
var b = 3;

[a, b] = [b, a];
console.log(a); // 3
console.log(b); // 1