Skip to content

Instantly share code, notes, and snippets.

@chickenfoot88
Created July 1, 2019 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chickenfoot88/167c29617533da9ef1ee734d97b00e58 to your computer and use it in GitHub Desktop.
Save chickenfoot88/167c29617533da9ef1ee734d97b00e58 to your computer and use it in GitHub Desktop.
swaps values of two variables
let varA = 'A'
let varB = 'B'
function change() { [varA, varB] = [varB, varA] }
change()
console.log('varA', varA)
console.log('varB', varB)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment