Sign In
Get Random Element
Beginner
Get Random Element
Create a function called
getRandomElement
that takes in an array and returns a random element from the array. If the array is empty, throw a range error with the message 'Array is empty'.
Click to go back
Click to go forward
Refresh preview
Console
Submit
Solution
00:00
Back to Exercises