compactWhitespace
Compacts whitespaces in a string.
- Use
String.prototype.replace()
with a regular expression to replace all occurrences of 2 or more whitespace characters with a single space.
Compacts whitespaces in a string.
String.prototype.replace()
with a regular expression to replace all occurrences of 2 or more whitespace characters with a single space.