Skip to content

Modules: Array

Alex Bruno Cáceres edited this page Mar 2, 2023 · 2 revisions

Useful methods to deal with arrays.

getRandomItem

Gets a random element from a given array.

import{getRandomItem}from'@jsweb/utils/modules/array'constarray=[1,2,3,4,5]constrandom=getRandomItem(array)// returns a random item from the array

Clone this wiki locally