Javascript Array getRandomItem()

Description

Javascript Array getRandomItem()

Array.prototype.getRandomItem = function(){
    var index = Math.floor(Math.random() * this.length);
    return this[index];
};



PreviousNext

Related