Skip to content

Instantly share code, notes, and snippets.

@chinaHewei
Created January 4, 2018 16:04
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 chinaHewei/51361541cca302e3b89214ec09cbe85d to your computer and use it in GitHub Desktop.
Save chinaHewei/51361541cca302e3b89214ec09cbe85d to your computer and use it in GitHub Desktop.
JavaScript interesting code
let a = 2
let b = 1
console.log(`a --> ${a}\nb --> ${b}`)
// swap a and b
a = {x: b, y: (b = a)}.x
console.log(`a --> ${a}\nb --> ${b}`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment