Skip to content

Instantly share code, notes, and snippets.

@nonseodion
Last active March 24, 2020 17:06
Show Gist options
  • Save nonseodion/ebd4e65c0803f568333c2ea9c40cc7c8 to your computer and use it in GitHub Desktop.
Save nonseodion/ebd4e65c0803f568333c2ea9c40cc7c8 to your computer and use it in GitHub Desktop.
let gucci = “Gucci”;
let versace = “Versace”;
//We shall swap the values of versace and gucci variables
//Pre-ES6
let temp = gucci;
gucci = versace;
versace = gucci;
console.log(versace, “is better than”, gucci);
//Output: Gucci is better than Versace.
//Post-ES6
[gucci, versace] = [versace, gucci];
console.log(versace, “is better than”, gucci);
//Output: Gucci is better than Versace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment