display one random element in array js code example Example: get random element from array js var item = items[Math.floor(Math.random() * items.length)];