JavaScript Tutorial

The language for programming web pages.

JS Strings

JavaScript Strings

Strings in JavaScript are used for storing and manipulating text. Strings can be enclosed in single quotes, double quotes, or backticks (template literals).

Common String Methods:

  • length — String length
  • toUpperCase() / toLowerCase()
  • trim() — Remove whitespace
  • includes() — Check substring
  • replace() / replaceAll()
  • split() — Split to array
  • slice(start, end) — Extract substring
  • indexOf() — Find position

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics