Home/Exercises/Strings
exercise set · 29 challenges · beginner to hard

JavaScript String Exercises

Master JavaScript strings with interactive exercises covering string length, character access, case conversion, trimming, slicing, searching, replacing, splitting, joining, formatting, and text parsing. Write and test real code in your browser with immediate feedback.

Choose your next challenge

Exercises

Work from beginner to hard, or use the filters to find a specific skill.

29exercises
About this practice set

Practice JavaScript strings with real text

Strings represent text throughout JavaScript applications, from form input and usernames to messages, URLs, search terms, and API data. These JavaScript string exercises help you read, clean, search, format, compare, and parse that text with the methods developers use in everyday code.

The collection progresses from string positions, length, bracket access, case conversion, trimming, repetition, searching, and slicing into normalization, prefix and suffix checks, splitting, joining, padding, replacement, masking, counting, and careful truncation.

Later challenges turn string manipulation into realistic text-processing work: build URL slugs, extract content between markers, parse tag lists and query strings, handle quoted CSV, render placeholder text, and highlight search matches. You'll also debug common mistakes involving slice boundaries, indexOf return values, and the fact that JavaScript string methods return new values instead of changing the original string.

Exercises
29
Difficulty
Beginner to Hard
Good to know first
Know how to declare variables, recognize a JavaScript string value, and read a small function.
Start with String Positions

What you’ll practice

  • Read characters with indexes, bracket access, and string length
  • Normalize input with trimming and case conversion
  • Search text with includes, indexOf, startsWith, and endsWith
  • Slice strings and extract text between markers
  • Replace, repeat, pad, mask, and truncate text
  • Split and join names, tags, slugs, and other text data
  • Compare and count text without accidental case mismatches
  • Parse query strings and CSV, render placeholders, and highlight matches

Who these exercises are for

This practice set starts with beginner-friendly string basics and develops into harder parsing and formatting challenges. It works for first-time JavaScript learners, students reinforcing a course, and developers sharpening their text-processing and debugging skills.

How practice works

  • Write and run JavaScript directly in your browser
  • Use instant test feedback to catch indexing and formatting mistakes
  • Progress from basic string access to practical parsing challenges
  • Filter exercises by difficulty and save your progress when signed in