JavaScript String includes method | Search one string into another string

JavaScript String includes a method used to determines whether a searching string contains found within another string. It will return a true if the string contains the characters otherwise false.

Note: The JS includes() method is case sensitive


Parameter Values

  • searchvalue: The string to search for.
  • start: At which position to start the search, optional and the default value is 0.

Return Value:

It will return true if string included else false indicating the absence.

Example of JavaScript String includes method

Let’ see an example of the string contains a character or not in js using the includes() method.

Let’s see if a string includes “world”:


JavaScript String includes method

Same example with starting the search at position 10:

It will return false because “world” word will not found after 10 portion.


include Search one string into another string

Do comment about this tutorial. If any suggestions and example then do comment.

Note: The All JS Examples codes are tested on the Safari browser (Version 12.0.2) and Chrome.
OS: macOS 10.14 Mojave
Code: HTML 5 Version

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.