Skip to content

arrPick

Returns a random item from the given array. If the array is empty or is not an array, it returns null.

Parameters

  • array::any[]

Returns

any | null

Examples

javascript
arrPick([1, 2, 3, 4, 5]); // Returns 1 or 2 or 3 or 4 or 5
arrPick([]); // Returns null

Released under the MIT License