Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.