Standard built-ins

String.prototype.includes()

Try the free JavaScript compiler

Tests literal containment from an optional offset; ordinary RegExp inputs are rejected.

Formal Syntax & Structure

javascript syntaxjavascript
text.includes(searchString, [position])

Parameters & Attributes

NameTypeDescription
searchStringStringLiteral sequence to locate.
positionNumberOptional search start position.

Return Value

Boolean

Whether a match exists.

Working Example

Example Snippetjavascript
console.log("book".includes("oo"));
JavaScript Reference