Check if a string contains a substring in JavaScript

1. ES6 .includes():

var S = "fullweb";
S.includes("web");

2. RegExp .search():

var S = "fullweb";
S.search(/web/);

3. RegExp .match():

var S = "fullweb";
S.match(/web/);

4. RegExp .test():

var S = "fullweb";
/web/.test(S)

5. Good old .indexOf():

var S = "fullweb";
S.indexOf("web");