Hi Everybody,
I suspect this is not so difficult, but it’s driving me crazy.
After the filter method leaves either a string or an empty string, I want an alert to reflect which came out.
Here is the closest I have gotten:
function wordCheck(wordInput) {
var wordList = ["sneeze bleshu","fart omg"];
var wordResult = "";
var wordInput = wordInput.toLowerCase().trim();
var filtered = "";
filtered = wordList.filter(function(val){
return val == wordInput;
});
return wordResult = filtered.join("");
}
function wordAlert() {
if (filtered == "") {
alert("Try Again, Kiddo!");
}
if (filtered !== "") {
alert("Good job!");
}
}
wordCheck("sneeze bleshu");
wordAlert();
Thanks for even looking at this!
Regards,
andy