Created
February 26, 2021 06:33
-
-
Save akbarjondev/0c587482992957c5bfa3e5c48384978d to your computer and use it in GitHub Desktop.
How to shuffle Array in JavaScript
This file contains hidden or 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
const shuffleArray = (arr) => { | |
const copyArr = [...arr] | |
return copyArr.sort(() => Math.random() - 0.5) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment