Created
January 5, 2023 15:52
-
-
Save gioiliop7/cb1f013884f9e7d66300570a3cf3b0d8 to your computer and use it in GitHub Desktop.
[JAVASCRIPT] Select random element from an array
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
function selectRandom(array) { | |
return array[Math.floor(Math.random() * array.length)]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment