# The String includes() method

> Learn how the JavaScript includes() method checks whether a string contains a given substring, and how an optional second argument sets where the search starts.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2019-02-19 | Topics: [JavaScript](https://flaviocopes.com/tags/js/) | Canonical: https://flaviocopes.com/javascript-string-includes/

Check if a string includes the value of the string passed as parameter..

```js
'JavaScript'.includes('Script') //true
'JavaScript'.includes('script') //false
'JavaScript'.includes('JavaScript') //true
'JavaScript'.includes('aSc') //true
'JavaScript'.includes('C++') //false
```

`includes()` also accepts an optional second parameter, an integer which indicates the position where to start searching for:

```js
'a nice string'.includes('nice') //true
'a nice string'.includes('nice', 3) //false
'a nice string'.includes('nice', 2) //true
```
