String Methods
Length, toUpperCase, includes.
Strings come with lots of built in tools, called methods. You call a method with a dot, the method's name, and brackets. Let's meet the ones you'll use every day.

- Built-in tools
- string.method()
- The everyday ones
Everyday methods
To upper case and to lower case change the letters. Trim removes spaces from both ends, which is great for tidying what users type. Includes checks whether some text is inside. And replace swaps one piece of text for another. Run it.
const text = " Hello, World ";
console.log(text.trim());
console.log(text.toUpperCase());
console.log(text.toLowerCase().trim());
console.log(text.includes("World"));
console.log(text.trim().replace("World", "JavaScript"));Hello, World HELLO, WORLD hello, world true Hello, JavaScript
Slicing and splitting
Slice copies part of a string, from a start position up to, but not including, an end position. Split breaks a string into a list of pieces, wherever it finds a separator. Run it. Strings themselves never change. Methods always give you a new string.
const email = "ana@example.com";
console.log(email.slice(0, 3));
console.log(email.split("@"));
console.log(email.indexOf("@"));
console.log("original:", email);ana [ 'ana', 'example.com' ] 3 original: ana@example.com
Summary
String methods tidy, search, and cut text. They never change the original, they return a new string. Next, true and false values.
Key takeaways- trim, toUpperCase
- includes, replace
- slice, split