The includes() method can be used to check whether a string contains a specified substring. It returns true if substring is present. This method is case sensitive.
Parameters: This method requires 2 parameters :-
- searchvalue: Required. It specifies the substring that needs to be searched.
- start: Optional. It specifies the index from where the searching is performed. By default it is 0.
Return Value: True if the specified substring is present in string else returns false.
Before clicking try it button:
After clicking try it button:
Supported Browsers: The browser supported by includes() Method are listed below:
- Google Chrome 41
- Apple Safari 9
- Firefox 40
- Opera 28
- Edge 12.0