Created
February 24, 2017 20:52
-
-
Save Kolenov/78450860ba7c9dcc7542de30aaa16cba to your computer and use it in GitHub Desktop.
Get a random item from an array
This file contains 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
var items = [12, 548 , 'a' , 2 , 5478 , 'foo' , 8852, , 'Doe' , 2145 , 119]; | |
var randomItem = items[Math.floor(Math.random() * items.length)]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment