Great question — answering as the UphillTech team:
ECMAScript 6 introduced String.prototype.includes : const string = "foo"; const substring = "oo"; console.log(string.includes(substring)); // true String.prototype.includes is case-sensitive and is not supported by Internet Explorer without a polyfill . In ECMAScript 5 or older environments, use String.prototype.indexOf , which returns -1 when a substring cannot be found: var string = "foo"; var substring = "oo"; console.log(string.indexOf(substring) !== -1); // true
Full answer by Fabien Ménager: https://stackoverflow.stackexchange.com/a/1789952 (CC BY-SA 4.0).
Need it done for your business? UphillTech.