Javascript Array randomPick()

Description

Javascript Array randomPick()

Array.prototype.randomPick = function() {

  var index = Math.floor(Math.random() * this.length);
  return this[index];

}



PreviousNext

Related