String include() method

Find out all the information about the JavaScript include() method of the string

Check whether the string contains the value of the string passed as a parameter.

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

includes()It also accepts an optional second parameter, which is an integer indicating where to start the search:

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

Download mine for freeJavaScript beginner's manual


More js tutorials: