JavaScript9 min read

JavaScript String Methods: Complete Guide

Complete guide to JavaScript string methods. Learn manipulation, searching, and transformation.

Alex Thompson
December 19, 2025
0.0k0

JavaScript String Methods: Complete Guide

Common String Methods

const text = 'Hello World';

text.length;              // 11
text.toUpperCase();       // "HELLO WORLD"
text.toLowerCase();       // "hello world"
text.includes('World');   // true
text.indexOf('o');        // 4
text.lastIndexOf('o');    // 7
text.slice(0, 5);         // "Hello"
text.substring(0, 5);     // "Hello"
text.replace('World', 'JS'); // "Hello JS"
text.split(' ');          // ["Hello", "World"]
text.trim();              // Remove whitespace
text.startsWith('Hello'); // true
text.endsWith('World');   // true

Key Takeaway

String methods manipulate text. Use includes() to check, slice() to extract, replace() to change. Essential for text processing.

#JavaScript#Strings#Methods#Beginner