Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.
The includes() method of String values performs a case-sensitive search to determine whether a given string may be found within this string, returning true or false as appropriate.
A string to be searched for within str. Cannot be a regex. All values that are not regexes are coerced to strings, so omitting it or passing undefined causes includes() to search for the string "undefined", which is rarely what you want.
position OptionalThe position within the string at which to begin searching for searchString. (Defaults to 0.)
true if the search string is found anywhere within the given string, including when searchString is an empty string; otherwise, false.
Thrown if searchString is a regex.
This method lets you determine whether or not a string includes another string.
The includes() method is case sensitive. For example, the following expression returns false:
You can work around this constraint by transforming both the original string and the search string to all lowercase:
| ECMAScript® 2027 Language Specification # sec-string.prototype.includes |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.