How to output unique random element from an array?
>Solution :
You could do it like this:
const getRand = function(arrayOfVals) {
const randIdx = Math.trunc(Math.random() * arrayOfVals.length);
return arrayOfVals[randIdx]
}
console.log(getRand([1, 2, 'a', 3, 'b', 'c']))
