Thuta Learning
JavaScript
IntermediateProgrammingbeginner

JS String Methods

JavaScript strings are used to store text. String methods let you manipulate strings.

• length: the length

• slice(): cuts out a portion

• toUpperCase(): converts to uppercase

• includes(): checks whether text is included

javascript
let text = "Hello World!";
let length = text.length;
let part = text.slice(6, 11); // from index 6 to 10
let upper = text.toUpperCase();

console.log("Length: " + length);
console.log("Part: " + part);
console.log("Upper: " + upper);
You should see
Length: 12 Part: World Upper: HELLO WORLD!
JS String Methods | Thuta Learning