MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / randomItem

Function randomItem

client/src/utils/get-words.ts:24–26  ·  view source on GitHub ↗
(arr: T[])

Source from the content-addressed store, hash-verified

22`;
23
24function randomItem<T>(arr: T[]): T {
25 return arr[Math.floor(Math.random() * arr.length)];
26}
27
28export function randomQuote(): Quote {
29 return randomItem(words.motivationalQuotes);

Callers 2

randomQuoteFunction · 0.85
randomComplimentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected