Strings — Complete Guide
Strings — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of JavaScript Tutorial on Toolliyo Academy.
On this page
JavaScript Tutorial · Lesson 31 of 100
Strings
Basics ✓ → Objects & data → Async & DOM → Advanced → Tools → Projects
Intermediate · 2 — Built-in types & objects · ~6 min · JS Strings, Dates & RegEx
What is this?
Strings hold text. JavaScript strings have useful methods: length, slice, toUpperCase, includes, split, and more.
Why should you care?
Almost every app formats names, searches text, and parses user input from strings.
See it live — copy this example
Paste into an HTML file or the browser console (F12). Use Run below when the live editor is available.
const msg = "Hello, JavaScript";
console.log(msg.length);
console.log(msg.toUpperCase());
console.log(msg.includes("Java"));
console.log(msg.split(", "));
Run Example »
Edit the code below and click Run to see the result in Toolliyo’s live editor.
What happened?
- Strings are immutable — methods return new strings.
- split turns text into an array.
Practice next
- Run length, toUpperCase, includes, split.
- Try trim on " hi ".
- Compare indexOf vs includes.
- Use slice to extract the first three characters of a product SKU.
- Replace all spaces with hyphens using replaceAll or split/join.
Remember
Double or single quotes Methods return new strings split/join convert array ↔ string
ScriptVerse search box
User queries are trimmed and lowercased with string methods before filtering product names.
Outcome: Consistent string normalization improves search match rates.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!