なぜこれが機能しないのか誰か教えてください。私は構造をたくさん変えようとしましたが、何を入れても問題ないようです。 if else ステートメントが適用されると、機能しなくなります。
function wordSplit(){
var sentence = document.getElementById("two").value;
var userWords=sentence.split(" ");
while(t<userWords.length){
alert(userWords[t]);
t++
};
x = 0;
for (var x = 0; x < userWords.length; x++){
y = 0;
for (var y = 0; y < vocab.length; y++){
if (y<vocab.length) {
alert("y is less than vocab")
};
else if (vocab[y] == userWords[x]){
alert("y is equal to x")
};
else if(y<vocab.length) {
alert("y is less than vocab 2")
};
else if (y == vocab.length){
alert(" y is equal to vocab length")
};
else if (y == 0)
{
alert("y is equal to zero)
};
};
};
};