How to check whether a string contains a substring in JavaScript without jQuery
You can use the following code to check whether a string contains a substring in JavaScript without jQuery.
var string = "main string",
substring = "ain";
string.indexOf(substring) !== -1;