Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save animanoir/d7df7a54fb130a9e48d355961be647f6 to your computer and use it in GitHub Desktop.
Save animanoir/d7df7a54fb130a9e48d355961be647f6 to your computer and use it in GitHub Desktop.
// Forma elegante de sacar un item al azar de un array desde una función.
Array.prototype.random = function () {
return this[~~(Math.random() * this.length - 1)]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment