Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to check whether a string contains a substring in JavaScript?


ECMAScript 6 introduced String.prototype.includes:

const string = "foo";
const substring = "oo";

console.log(string.includes(substring)); // true
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #check #string #substring
ADD COMMENT
Topic
Name
5+7 =