You can get a random index using
let i = Math.floor(Math.random() * array.length)
,
then you should remove the elment from the array maybe using
arr.splice(i ,1)
.
This could be a sample:
let arr = [1,2,3,4,5];
for(let n in arr)
removeRandom(arr);
function removeRandom(arr){
let i = Math.floor(Math.random() * arr.length);
let str= "pre "
for(let n in arr)
str += arr[n] ;
console.log("str "+str)
console.log("arr[i] " + arr[i]);
arr.splice(i ,1);
str= "post "
for(let n in arr)
str += arr[n] ;
console.log("str "+str)
}