MCPcopy Create free account
hub / github.com/CleverProgrammers/JavaScript-Course-by-Clever-Programmer- / randomFruit

Function randomFruit

playground.js:366–372  ·  view source on GitHub ↗
(fruits)

Source from the content-addressed store, hash-verified

364// randomFruit([1, 2]) 👉 2
365// randomFruit([1, 2]) 👉 1
366const randomFruit = (fruits) => {
367 const randomNumber = Math.floor(Math.random() * fruits.length)
368
369 console.log(randomNumber)
370
371 return fruits[randomNumber]
372}
373
374// fruits = ['🍌', '🍎', '🍊', '🍐']
375// console.log(randomFruit(fruits))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected