As an argument to made dependent on the variable?

In this case, to do so you can set the value through a variable?
var words = ["snow", "red"]
var input = "red";
var result = words.toString().match("/" + input + "/gi");
alert(result)
July 2nd 19 at 17:37
1 answer
July 2nd 19 at 17:39
Solution
If the task is to find the word in the array, then for this example has a method indexOf.

Find more questions by tags JavaScript