Skip to content

Instantly share code, notes, and snippets.

@agamm
Last active October 13, 2022 22:07
Show Gist options
  • Save agamm/80ae48dd3ee0fc5bbec5 to your computer and use it in GitHub Desktop.
Save agamm/80ae48dd3ee0fc5bbec5 to your computer and use it in GitHub Desktop.
Javascript random choice picker.
function makemychoice() {
args = Array.prototype.slice.call(arguments);
return ( args[~~(args.length * Math.random())] ) + " was chosen.";
}
// Example: makemychoice("Go to run", "Go to swim", "Fix bug");
// from the creator of unzip.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment