Please share your thoughts on my random quote machine

Hi all,

Just finished my random quote machine. It has a very simple design, nothing fancy. Will appreciate any feedback.

It seems to work well! I like the simple design too. Well done! :slight_smile:

1 Like

That looks great! You’ve got a clever way of selecting the quote and author, but there’s a small change we can make to the way you store quotes to improve the inner workings of the app. Instead of having two arrays, one with quotes and one with authors, you could have an array of objects. Each object would have both the quote and the author together.

var quotes = [{
    text: "Life is the best",
    author: "A happy person"
},
{
    text: "Life is awful",
    author: "A sad person"
}
];

Then you can get the random quote much like you’re doing, but you’ve got quote.text and quote.author. This is just a bit easier to read, debug, and make changes to in the future.

1 Like

Simple and effective. I really like it. Nice work!

1 Like

Thanks for your words of encouragement!

@PortableStick That’s a good idea. It makes the code simpler too. Thanks for the help!