Skip to content

Instantly share code, notes, and snippets.

@waldothedeveloper
Created May 18, 2018 12:10
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 waldothedeveloper/51ba372ef77f632864784ccd0f338be6 to your computer and use it in GitHub Desktop.
Save waldothedeveloper/51ba372ef77f632864784ccd0f338be6 to your computer and use it in GitHub Desktop.
Another workaround for the random quotes assuming you save a bunch of quotes in an array
$(document).ready(()=> {
console.log("ready");
let quotesArray = ["quote1", "quote2", "quote3", "quote4", "quote5", "quote6", "quote7", "quote8", "quote9", "quote10"];
function randomQuote() {
let randQuote = Math.floor(Math.random() * quotesArray.length);
return $("p#quote").text(quotesArray[randQuote]);
};
$("a#quote-button").on("click", () => {
return randomQuote();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment