Function: randomItem()
randomItem<
Item>(arr):Item
Defined in: functions/randomItem.ts:12
Returns a random item from the given array.
Type Parameters
Item
Item = any
Parameters
arr
Item[]
The array to get the item from.
Returns
Item
The random item from the array.
Example
randomItem(["red", "green", "blue"]); // "red"