I found this project fairly simple, I’ve actually done something similar but in python.
It didn’t take me long at all, which makes me think I may have missed something or done this incorrectly.
The messages themselves are meant to be silly and NOT meant to be taken seriously.
Please let me know what you think of my work and how I could improve it. Thank you!
Hello, and welcome to the forums
I think your project is still private. The link doesn’t work and I don’t see one named mixed_messages on your GitHub
whoops, thank you! just made it public, I believe.
That worked!
There is one thing you can improve:
let randIndex = Math.floor(Math.random() * (this.places.length - 1));
By subtracting 1 from the array length, you’re making it so the last index of your array can’t be chosen. The combination of Math.floor()
and Math.random()
already ensures that the maximum number will never equal the length, so subtracting one is not necessary.
This means your current code could never give your user this valuable first date idea:
“You should take them to the zoo and adopt a dog. When you’re finished don’t forget to tell them you had a good time but you’re not really feeling a connection! Guaranteed they will never forget.”
Ah, I was too clever for my own good. Thanks for the input!
I liked it! Now that you fixed the Math.random(floor thing mentioned above it looks great to me. I like how you made it as methods of an object, instead of functions.
Please check out my project too! https://repl.it/@RebeccaHellstrm/DndCharGenerator#app.js
I love this idea. Definitely going to look at this next time I do a one shot.
Is there a reason you have it set to pump out ten at a time? It is a little overwhelming, and the numbers made me think it was somehow interactive.
I did it because I thought it would be a bit too manual to press and run the whole script for 1 at a time. But I could definitely make the list with more spaces between each entry, so it’s easier to navigate visually. Thanks for your feedback!