ProgramsJavaScript

JavaScript String Programs

Handle text in JavaScript. Reverse strings, count vowels and words, change case and check palindromes, with every line of code explained and its output shown.

5 programs · open one, then the next

Start with String Length
  1. 01String LengthBeginnerFind string length in JavaScript with .length, a loop and split. Count characters, count words and see why emoji count as 2. Explanation and output.Open example →
  2. 02Reverse a StringBeginnerReverse a string in JavaScript with split, reverse and join, plus loops, reduce, recursion and spread. Includes the emoji trap, with explanation and output.Open example →
  3. 03String Palindrome CheckBeginnerCheck a string palindrome in JavaScript: lowercase, strip spaces and symbols, then compare. "A man a plan a canal Panama" passes. Explanation and output.Open example →
  4. 04Anagram CheckIntermediateCheck if two strings are anagrams in JavaScript by sorting letters or counting them. "listen" and "silent" match. Full explanation, gotchas and output.Open example →
  5. 05Count Vowels in StringBeginnerCount vowels in a string in JavaScript with loops, filter, reduce and regex. Also counts each vowel on its own, with a clear explanation and output.Open example →