Skip to content

Commit

Permalink
MOD. generate statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhirano0715 committed Mar 18, 2023
1 parent a5c0cd0 commit f83c45c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,22 @@
})
.catch(error => console.error(error));

const nounList = wordList.filter(word => word.type === 'noun');
const particleList = wordList.filter(word => word.type === 'particle');
const verbList = wordList.filter(word.type === 'verb');

setInterval(() => {
const textContainer = document.getElementById("text-container");

// Filter the array to get only the words with the desired types
const filteredList = wordList.filter(word => word.type === 'noun' || word.type === 'verb' || word.type === 'particle');
// const filteredList = wordList.filter(word => word.type === 'noun' || word.type === 'verb' || word.type === 'particle');

// Select a random word from the filtered list
const selectedWord = filteredList[Math.floor(Math.random() * filteredList.length)];
const noun = nounList[Math.floor(Math.random() * nounList.length)];
const particle = particleList[Math.floor(Math.random() * particleList.length)];
const verb = verbList[Math.floor(Math.random() * verbList.length)];

textContainer.innerText = selectedWord.word;
textContainer.innerText = noun.word + " " + particle.word + " " + verb.word;
}, 5000);
</script>
</body>
Expand Down

0 comments on commit f83c45c

Please sign in to comment.