_.sample(collection)
Gets a random element from collection
.
Since
2.0.0
Arguments
-
collection
(Array|Object): The collection to sample.
Returns
(*): Returns the random element.
Example
1 2 | _.sample([1, 2, 3, 4]); // => 2 |
_.sample(collection)
Gets a random element from collection
.
2.0.0
collection
(Array|Object): The collection to sample.(*): Returns the random element.
1 2 | _.sample([1, 2, 3, 4]); // => 2 |
Designed by : w10schools
service@w10schools.com
Please login to continue.