How to check whether a string contains a substring in JavaScript?
ECMAScript 6 introduced String.prototype.includes:
const string = "Hello World!";
const substring = "World";
console.log(string.includes(substring)); // true
Note: includes doesn’t have Internet Explorer support. In ECMAScript 5 or older environment...
heyitsvajid.hashnode.dev1 min read