This is a great start to you Mixed Messages project! I created something similar to yours, and my biggest struggle was adding the random words into random sentences. It’s always interesting to see how others reach the same end result! I’m still figuring out a better way to collect and implement the words for my final result.
If you want to continue with this project, perhaps some challenges you can look into are:
- How would you handle if someone wanted to add a sentence that actually uses the word “noun”, “verb” or “adverb”? Ex. The noun of this sentence is [insert random word].
- How would you handle singular/plural of nouns and tenses of verbs?
- How would you handle multiple nouns, verbs or adverbs in your phrase?
- When you have multiple nouns, verbs or adverbs, do you want any of them to repeat in the phrase?
On a side note, in randomNumber, your nums[Math.floor(Math.random() * nums.length)] is redundant since the array value is returning the same value as the index. You can just as easily write:
const randomNumber = num => Math.floor(Math.random() * num);
The num variable wouldn’t be necessary if the number would always be the same, but if you want flexibility, you can get your noun, for example, with
Keep up the good work!