Last active
September 3, 2018 17:00
-
-
Save marcelo-ribeiro/23f775805f97a301febc3b133200d3da to your computer and use it in GitHub Desktop.
Trim All White Spaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
if (!String.prototype.trimAll) { | |
String.prototype.trimAll = function () { | |
return this.replace(/\s+/g, ''); | |
}; | |
} | |
})(); | |
// Example | |
console.log(' Hello World '.trimAll()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment