In this code I created objects, which contain adjectives, or nouns in different gender. I also typed "beautiful maxim", and despite the fact that EnAdjectives has "beautiful" and "maxim" belongs to "EnMaleNouns", else
statement executes.
let EnMaleNouns = {...};
let EnAdjectives = {...};
function conj() {
let sentence = document.getElementById("input_one").value.split(" ").filter(item => item != "")
let final = [];
for (let word in sentence) {
for (let key in EnAdjectives) {
if (sentence[word] == key && sentence[++word] in EnMaleNouns) {
//do something
} else {
//do something
}
}
}
}
Can anyone tell me how to fix that, and why this is happening?