Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save StuffbyYuki/24d915a1061b4a385b644ccbd7b5ffc0 to your computer and use it in GitHub Desktop.
Save StuffbyYuki/24d915a1061b4a385b644ccbd7b5ffc0 to your computer and use it in GitHub Desktop.
JS - Get random element from the specified array
//You specify an array of item in the argument
function random_item(items) {
return items[Math.floor(Math.random()*items.length)];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment