Skip to content

Instantly share code, notes, and snippets.

@Sinequanonh
Forked from guilhermepontes/shuffle.js
Created November 27, 2017 01:30
Show Gist options
  • Save Sinequanonh/06a7a5a9c632c410cf71b3dbe4fbbbc9 to your computer and use it in GitHub Desktop.
Save Sinequanonh/06a7a5a9c632c410cf71b3dbe4fbbbc9 to your computer and use it in GitHub Desktop.
Shuffle array element ES2015, ES6
const shuffleArray = arr => arr.sort(() => Math.random() - 0.5)
shuffleArray([1, 2, 3]) //[3, 1, 2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment