Letβs write a function to return a random element from an array. We can use Math.random() to generate a number between 0β1(inclusive of 0, but not 1) randomly. Then multiply the random number with the length of the array. floor to result to make it whole numberΒ . Thatβs it we find the random Index. Letβs …