I want to make a filter. Where if you input a word that is in the 'blacklist' it will tell something. I've got all the code but have a problem.
JS:
input = document.getElementById("input").value;
array = ["1","2","3"];
function filter() {
if (input == array)
// I will do something.
} else {
// Something too
}
}
I want to make it so that if the input
is a item in the array
. That the statement is true. But what is the correct way to do this? Because what I'm doing here doesn't work! Also I want to get rid of the case sensitive! So that if the array has hello
in it both hello
and Hello
are detected.
Sorry if this question is asked before. I searched for it but didn't know what keywords to use.
EDIT 1:
I am changing my question a little bit: I want to check what is in my original question but with some other features.
I also want to check if input
has a part of an item in array
. So that if the input is hello
that helloworld
is being detected because is has hello
in it. As well as hello
or Hello
.