As explained in How do you search multiple strings with the .search() Method?, you can use multiple arguments inside .search()
.
But how can I know which of the arguments given inside .search()
returns a positive value?
E.g:
var search = string.search("hello|world|not");
if (search.positiveArgument == 1) {
//"hello" was found
} else if (search.positiveArgument == 2) {
//"world" was found
etc...
I am aware that .positiveArgument
isn't valid, it is purely for example purposes.