Get a random item from the given array.
Type of the array elements.
array
The array to retrieve a random item from.
A random item from the array.
randomItem(['a', 'b', 'c', 'd', 'e']);// => 'c'randomItem(['a', 'b', 'c', 'd', 'e']);// => 'e'randomItem([]);// => undefined Copy
randomItem(['a', 'b', 'c', 'd', 'e']);// => 'c'randomItem(['a', 'b', 'c', 'd', 'e']);// => 'e'randomItem([]);// => undefined
Get a random item from the given array.