var item = items[Math.floor(Math.random()*items.length)];
More Related Contents:
- How to randomize (shuffle) a JavaScript array?
- Generate unique number within range (0 – X), keeping a history to prevent duplicates
- Create an array with random values
- Sampling a random subset from an array
- Creating array of length n with random numbers in JavaScript
- Convert JSON to array in Javascript
- Do not include in random number
- Creating a JavaScript global array with static elements?
- Cartesian product of multiple arrays in JavaScript
- Counting the occurrences / frequency of array elements
- Does JavaScript have a method like “range()” to generate a range within the supplied bounds?
- How to count duplicate value in an array in javascript
- Get the index of the object inside an array, matching a condition
- Sort mixed alpha/numeric array
- Sorting arrays numerically by object property value
- What is the most efficient way to concatenate N arrays?
- How to know if two arrays have the same values
- Why doesn’t nodelist have forEach?
- Javascript Array.prototype.filter() not working
- Are JavaScript Arrays actually implemented as arrays?
- Generate random password string with requirements in javascript
- Strange behavior of an array filled by Array.prototype.fill()
- How can I remove a specific item from an array in JavaScript?
- What does the Array method `reduce` do?
- Elegant method to generate array of random dates within two dates
- Best way to flatten JS object (keys and values) to a single depth array
- Convert string array to integer array
- Group javascript array object by same key
- Find last index of element inside array by certain condition
- How to flatten array in jQuery?