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
BUY
ΣJS
JavaScript in Depth

JS Obj Reference

String

prototype