String Methods — Free JavaScript Tutorial

Learn String Methods in JavaScript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

String Methods — Free JavaScript Tutorial

Learn String Methods in JavaScript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

✓ 100% Free ✓ No Login Needed ✓ NCERT / CBSE Aligned ✓ Download as PDF

TL;DR: Learn String Methods in JavaScript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated

🤖 Stuck on any question? Ask Syllab's free AI Tutor for a step-by-step explanation — instant, unlimited, no login.

String Methods in JavaScript

Strings in JS are immutable sequences of characters. Use single quotes, double quotes, or backticks (template literals).

Key methods: `.length`, `.toUpperCase()`, `.toLowerCase()`, `.trim()` (remove spaces), `.split()`, `.join()`, `.includes()`, `.startsWith()`, `.endsWith()`.

Slicing: `.slice(start, end)` — end not included. `.substring(start, end)` — similar. `.charAt(index)` or `str[index]`.

Replace: `.replace(old, new)` — first occurrence only. `.replaceAll(old, new)` — all. `.repeat(n)` — repeat string n times.

Learn String Methods step by step with Syllab's free interactive JavaScript tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full JavaScript course →