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