String Searching
JS · Stringssyntax
str.includes(search, startIndex)
str.startsWith(search)
str.endsWith(search)example
const msg = "Order #1234 shipped";
console.log(msg.includes("shipped")); // true
console.log(msg.startsWith("Order")); // true
console.log(msg.endsWith("shipped")); // true
console.log(msg.indexOf("#")); // 6Note All search methods are case-sensitive. For case-insensitive checks, lowercase both sides first: str.toLowerCase().includes(term.toLowerCase()).