To check if one one string contains another string in Javascript you can use the following method.

Sample JS

if(testString.indexOf("substring") > -1){
}

4 thought on “How to check if one one string contains another string in Javascript”

Leave a Reply