Please share your thoughts on my random quote machine

Please share your thoughts on my random quote machine
0

#1

Hi all,

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


#2

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


#3

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.


#4

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


#5

Thanks for your words of encouragement!


#6

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