Hello,
I want to improve my random quote machine. Instead of hard-coding my quotes into the js file, I want to list them all in a text file. I thought this would make it easier for me to continuously add quotes to the program without changing any of the code itself.
Is this a good idea? I’ve been reading into FileReaders and thought that I could use a FileList to go through the quotes. I structured the text file so the quote is always on a single line with the author on the line below it, followed by a new line. I would not use the entire list for one user. Let’s say I have about 50 quotes (probably more), I would only grab 10 of them randomly from the text file and insert them into the program.
My only issue I keep thinking of is how to keep the program from choosing the same quote more than once within the 10 to pick. In the hard-coded version, I had a boolean value for each quote that determined whether its quote was already displayed.
I appreciate any feedback or better alternatives to this idea. I just want to have a way for a user to see all the new quotes I keep collecting.
Thank you!