Skip to main content
Very minor edits for clarity
Source Link
MultiplyByZer0
  • 7.3k
  • 3
  • 35
  • 49

How can I automatically replace all instances of multiple spaces, with onea single space, in Javascript?

I've tried with just chaining some s.replaces.replace but this doesn't seem optimal.

I'm using jQuery as well, in case it's a builtin functionality.

How can I automatically replace all multiple spaces with one single space in Javascript?

I've tried with just chaining some s.replace but this doesn't seem optimal.

I'm using jQuery as well in case it's a builtin functionality.

How can I automatically replace all instances of multiple spaces, with a single space, in Javascript?

I've tried chaining some s.replace but this doesn't seem optimal.

I'm using jQuery as well, in case it's a builtin functionality.

Post Closed as "Duplicate" by James Lawruk, Ryan Kempt, cHao, biegleux, Santosh Panda
Source Link
Alex
  • 77.7k
  • 91
  • 267
  • 350

Remove all multiple spaces in Javascript and replace with single space

How can I automatically replace all multiple spaces with one single space in Javascript?

I've tried with just chaining some s.replace but this doesn't seem optimal.

I'm using jQuery as well in case it's a builtin functionality.