String Search & Indexing

let str = "hello world hello";
console.log(str.indexOf("hello"));       // 0 (first occurrence)
console.log(str.indexOf("hello", 5));    // 12 (search after index 5)
console.log(str.lastIndexOf("hello"));   // 12 (last occurrence)
console.log("hello".includes("ll")); // true
console.log("hello".startsWith("he")); // true
console.log("hello.js".endsWith(".js")); // true

Extracting & Modifying Strings

let str = "Hello";
console.log(str.charAt(1)); // "e"
console.log("JavaScript".substring(4, 10)); // "Script"
console.log("JavaScript".substring(10, 4)); // "Script" (arguments swapped)
console.log("JavaScript".slice(-6)); // "Script"
console.log("JavaScript".slice(10, 4)); // "" (empty, as arguments are not swapped)
let str = "apple,banana,grape";
console.log(str.split(",")); // ["apple", "banana", "grape"]

Case Transformation