JavaScript: String.prototype.includes

By Xah Lee. Date: . Last updated: .

New in JS2015.

str.includes( searchString )
Return true if str contains searchString. Else, return false.
str.includes( searchString , position )
Start search at position.
const g = "abcd";

console.log( g.includes("cd") ); // true
console.log( g.includes("cd", 3) ); // false

console.log( g.includes("x") ); // false
JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

String

prototype