0

var string = "Community!"

string.indexOf("workingcode") returns -1, since the string is not found.

var string = "workingcode Community!"

string.indexOf("workingcode") returns is not -1, string found.

Use of indexOf("searchString") in ServiceNow
Working Code Asked question June 29, 2023