How to get random element from array in JavaScript

Arrays
By Jad Joubran · 
Last updated Aug 18, 2022
const names = ["Sam", "Alex", "Charley"];

names.at(Math.random() * names.length);
a random element from the names array
String.at() on Learn JavaScript Blog