# String Methods — JavaScript

Source: https://www.geekswithgeeks.com/en/javascript/js-string-methods

> Everyday text operations, all non-mutating.

## Everyday methods

Case, whitespace and search helpers cover most everyday text cleanup.

```js
const s = "  Hello JS  ";
console.log(s.trim());
console.log(s.toUpperCase());
console.log(s.trim().includes("JS"));
console.log(s.replace("JS", "World"));
```

## Slicing & splitting

`split()` turns text into an array; `slice()` extracts a substring by position.

```js
const csv = "apple,banana,cherry";
console.log(csv.split(","));        // ['apple', 'banana', 'cherry']
console.log("Hello".slice(1, 4));   // "ell"
```

## Strings are immutable

Every string method returns a **new** string — the original value never changes.
