Created
July 1, 2019 10:07
-
-
Save chickenfoot88/167c29617533da9ef1ee734d97b00e58 to your computer and use it in GitHub Desktop.
swaps values of two variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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