I'm working on a simple dictionary website challenge for a job position, and I need to consume a JSON file with an array of strings and display a list of words on the screen; however, this file provided by the challenge has not only words but phrases as well, which is also being displayed on the screen, and I would like to get rid of them!
I'm trying to filter the array and get the strings with only ONE word.
Is that possible? If so, could you please help me?
See below a part of the array. This file has more than 130k strings with words/phrases, so I can't delete the phases myself!
[
"acciaccatura",
"accident",
"accidental",
"accidentally",
"accidentally on purpose",
"accident and emergency",
]
Also, see below the code with the .map() I'm using to display the words on the screen.
<div className="word-container">
{words.map((data) => (
<span className="word">{data}</span>
))}
</div>
Many thanks!
Ps.: this is my first ever question here, so I apologise if I made any mistake. I'm also new to coding, so I'm trying to get used to using more StackOverflow!