JavaScript Swap variables in JS

Swap variables in JS

<script>
var x = '123';
var y = '456';

y = [x, x = y][0];

alert(x);
alert(y);
  
</script>