0

I have a string that looks like:

dog cat hello   house apple    fork bird

I want to change the string to look like:

dog cat hello house apple fork bird

How would I achieve this using JavaScript and/or jQuery?

1 Answers1

0

str = str.replace(/[\s]+/g, ' ');

Brad Wells
  • 429
  • 2
  • 5