Skip to content

Instantly share code, notes, and snippets.

@juliovedovatto
Last active November 25, 2016 18:13
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 juliovedovatto/1a46357888dde6253324ea2505ed9dfa to your computer and use it in GitHub Desktop.
Save juliovedovatto/1a46357888dde6253324ea2505ed9dfa to your computer and use it in GitHub Desktop.
Javascript snippet to swap elements in array
// one line code to swap elements in array
arr[x] = [arr[y],arr[y] = arr[x]][0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment