![]() |
VOOZH | about |
The random() function as the name suggest it returns any random value from the collection. In JavaScript, the array is first converted to a collection and then the function is applied to the collection.
Syntax:
data.random(number)
Parameters: This function accept a single parameter as mentioned above and described below
Return Value: Returns random value or values from collection.
Below examples illustrate the random() function in collect.js
Example 1:Return single random value.
Output:
6
Example 2: Return multiple random values.