JavaScript Includes

includes() checks whether a string contains a given substring and returns a boolean. True or false. The search is case-sensitive. It is the clean, readable replacement for the old indexOf(...) !== -1 idiom.

Syntax

str.includes(search)

Examples

Input Arguments Output
"hello world" "world" true
"hello" "H" false
↳ Case-sensitive: "H" ≠ "h".

When to use it

  • Filter a list by keyword.
  • Guard logic on the presence of a marker or flag in text.

Gotchas

  • Case-sensitive. Lowercase both sides first for a case-insensitive check.

Try it live

Type your input and see Includes transform it instantly.

Includes()

Type above to see the result…

Want to go further? Chain Includes with other functions, pipe one output into the next and watch your data transform in the visual Playground.

Related functions

© 2026 Heifara Buval