0
How can you make a if statement that a prompt tags value is not any value of a array?
So a example will be alerting(Using alertia which makes cool alerts) if the prompt value is not a array. So my code has a 32 amount of values in my array. Then I wrote a if statement. if (askPrompt == keywords[0]) { //alert than it isnât a good variable name. } But it would take forever to write keywords[0] to keywords[31] for array indices.
2 Answers
+ 3
if (!keywords.includes(varName)) {
alert("Not a valid variable name")
}