Created
September 13, 2018 16:03
-
-
Save jordanhudgens/276132c6b7b6745a81b0fb5e053846d0 to your computer and use it in GitHub Desktop.
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 sample = arr => { | |
const randomIndex = Math.floor(Math.random() * arr.length); | |
return arr[randomIndex]; | |
}; | |
sample([1, 2, 3]); // 3 | |
sample([90, 500, 100, -20]); // 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment