Skip to content

Instantly share code, notes, and snippets.

@jaredwilli
Created August 6, 2012 13:01
Show Gist options
  • Select an option

  • Save jaredwilli/3274317 to your computer and use it in GitHub Desktop.

Select an option

Save jaredwilli/3274317 to your computer and use it in GitHub Desktop.
javascript trim
if (!String.prototype.trim) {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,'');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment