Random Quote Generator - Please give me feedback!

I didn’t use API’s mainly because I wanted it to be a cool site, I hope you guys like the style, I would really apreciate it if you helped me clean my code as well :slight_smile:.

Have a nice day!

JoakoSz

1 Like

LOL A+ for the humorous quotes !

1 Like

the quotes are awesome but i think your code may look a little cleaner if you combine your quotes and authors into a single array… say

 function newQuote() {
    var quotes = [
        {"quote": "Get off my yard", "author": "  -Some old man"},
        {"quote": "Now I'll have to make the weather app, I'm scared","author":"  -Not me, I swear"},
        {"quote":  "Man I love heavy metal":, "author":  "  -Steve Jobs"},
        {"quote":  "One day I will be in a random Quote Generator": "author": " -A prophet"},
        {"quote": ""I can't believe I've been missquoted": "author": "Me, just now}
    ]
   var randomInt = Math.floor(Math.random()*quotes.length;
   randomQuote = quotes[randomInt].quote;
   randomAuthor = quotes[randomInt].author;
    
    $(".quote").text(randomQuote);
    $(".author").text(randomAuthor);
}

I think that would improve the code’s readability. Also it makes it easier to move all your quotes to an external JSON file and add or remove quotes without affecting your source file