0

Array Help

How do you make it so Any value that’s inside of an Array that is used in a Input Text area it triggers a Condition?? Example Var Number = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] So Anything that’s inside that Variable, If it used in a Text Input it triggers a Command.

20th Mar 2018, 11:45 PM
AClue
AClue - avatar
1 Antwort
+ 1
Use a loop to iterate through every element in the array, then in that loop include an if statement to check whether that element is in the text box input. There are multiple ways to do so, you can pick one here: https://stackoverflow.com/questions/1789945/how-to-check-whether-a-string-contains-a-substring-in-javascript
21st Mar 2018, 12:43 AM
apex137
apex137 - avatar