Easy Tutorial
❮ Met Console Clear Event Onselect ❯

JavaScript includes() Method

JavaScript String Object

Example

Check if a string includes "tutorialpro":

n Output result:


Definition and Usage

The includes() method determines whether a string contains the specified substring.

It returns true if the string contains the substring, otherwise it returns false.

Note: The includes() method is case-sensitive.


Browser Support

Method
includes() 41 12.0 40 9 28

Syntax

string.includes(searchvalue, start)

Parameter Values

Parameter Description
searchvalue Required. The string to search for.
start Optional. The position to start the search from. Default is 0.

Return Value

Type Description
Boolean Returns true if the string contains the substring, otherwise returns false.

Technical Details

| JavaScript Version: | ECMAScript 6 | | --- | --- |


More Examples

Example

Search the string starting from the 12th index position:

n Output result:


JavaScript String Object

❮ Met Console Clear Event Onselect ❯