Created
May 18, 2018 12:10
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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