4.17.11
3.10.1
2.4.2
1.3.1
_.sample(collection)
Gets a random element from collection
.
Since
2.0.0
Arguments
argument
collection
type
(Array|Object)
description
The collection to sample.
Returns
(array)
Example
_.sample([1, 2, 3, 4]);
// => 2
_.sample([1, 2, 3, 4]);
// => 2