Skip to content

Instantly share code, notes, and snippets.

@VerduzcoTristan
Last active August 11, 2021 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VerduzcoTristan/e60b53bc5bcba30978d6279e2da343e1 to your computer and use it in GitHub Desktop.
Save VerduzcoTristan/e60b53bc5bcba30978d6279e2da343e1 to your computer and use it in GitHub Desktop.
main.js
const messages = ["You will have a great deal of luck", "You will find companionship", "You will acquare vast wealth."];
function pickRandomMessage(array){
let random = Math.random();
let index = Math.floor(random * array.length);
return array[index];
}
console.log(`${pickRandomMessage(messages)}`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment