includes()
ES6+Determines whether one string may be found within another string.
Syntax
string.includes(searchString, position)Parameters
searchString string The string to search for
position number optionalPosition to start searching from
Return Value
boolean
true if the string is found, otherwise false
Examples
JavaScript
const str = 'Hello World';
console.log(str.includes('World'));
console.log(str.includes('world')); Output:
// true
false