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