Skip to content

Instantly share code, notes, and snippets.

@Victa
Created October 30, 2012 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Victa/3979257 to your computer and use it in GitHub Desktop.
Save Victa/3979257 to your computer and use it in GitHub Desktop.
Add Javascript String.trim() Support for Older Browsers
String.prototype.trim = typeof (String.prototype.trim) != "undefined" ?
String.prototype.trim :
function() { return this.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment