JavaScript 2025 · Strings

Replace every occurrence

Replace all matches, not just the first.

const clean = text.replaceAll("-", " ");

Official JavaScript 2025 documentation

More strings commands

All strings commands · JavaScript 2025 cheatsheet

Was this page helpful?