Skip to content

Instantly share code, notes, and snippets.

@c0derabbit
c0derabbit / randomchoice.js
Created Jul 14, 2016
A JavaScript solution for random choice from an array.
View randomchoice.js
function randomChoice(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}