I want to create a small dictionary with Json and Javascript. Here is my Json file.
{
"entry": "proud",
"synonyms": ["noble", "illustrious"],
}
]
So the user should be able to search the entry (ie., proud) or any one of the synonym (noble or illustrious) and get the results.
My JS
const input = document.getElementById("input");
async function findWords(){
const res = await fetch('./dict.json');
const data = await res.json();
data.filter(function(item){
if(input.value === item.entry){
console.log(item.entry);
console.log(item.synonyms);
}
});
}