JavaScript String includes()
Example
Check if a string includes "world":
let str = "Hello world, welcome to the universe.";
str.includes("world") // Returns true
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The includes() method returns true
if a string contains a specified string, otherwise false.
includes() is case sensitive.
Browser Support
The numbers in the table specify the first browser version that fully supports the method.
| Chrome 41 | Edge 12 | Firefox 40 | Safari 9 | Opera 36 |
| Mar 2015 | Jul 2015 | Aug 2015 | Oct 2015 | Mar 2016 |
includes() is not supported in Internet Explorer.
Syntax
string.includes(searchvalue, start)
Parameter Values
| Parameter | Description |
|---|---|
| searchvalue | Required. The string to search for |
| start | Optional. Default 0. At which position to start the search |
Technical Details
| Return Value: | A Boolean. Returns true if the string contains the value, otherwise it returns false |
|---|---|
| JavaScript Version: | ECMAScript 6 |
More Examples
Check if a string includes "world", starting the search at position 12:
let str = "Hello world, welcome to the universe.";
str.includes("world", 12) // Returns false
Try it Yourself »

