English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript String includes() Method

 JavaScript String Object

includes()Method to determine if one string can be found in another string.

If the string contains a character, the includes() method will returntrue,Otherwise, it returnsfalse.

Note:This method is case-sensitive.

Syntax:

string.includes(searchValue, start)
var str = 'Air Pollution is introduction of chemicals to the atmosphere';
str.includes('Pollution39;);   // true
Test and see‹/›

Browser Compatibility

The numbers in the table specify the first browser version that fully supports the include() method:

Method
includes()4140Yes912

Parameter Value

ParameterDescription
searchValue(Required) The string to be searched in this string
start(Optional) Start searching in the stringposition of searchValue(Default is 0)

Technical Details

Return value:If the search string is found at any position within the given stringtrue;otherwisefalse
JavaScript version:ECMAScript 6

More examples

Check if the string contains "Air", from position2Start searching:

var str = 'Air Pollution is introduction of chemicals to the atmosphere';
str.includes('Air', 2);   // false
Test and see‹/›

 JavaScript String Object