Standard built-ins
String.prototype.includes()
Tests literal containment from an optional offset; ordinary RegExp inputs are rejected.
Formal Syntax & Structure
javascript syntaxjavascript
text.includes(searchString, [position])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| searchString | String | Literal sequence to locate. |
| position | Number | Optional search start position. |
Return Value
Boolean
Whether a match exists.
Working Example
Example Snippetjavascript
console.log("book".includes("oo"));