Skip to content

Instantly share code, notes, and snippets.

@shaunwallace
Created November 19, 2014 13:58
Show Gist options
  • Save shaunwallace/81e9d55556e72f95a3d1 to your computer and use it in GitHub Desktop.
Save shaunwallace/81e9d55556e72f95a3d1 to your computer and use it in GitHub Desktop.
String.prototype.trim()
var trimmed = ' foo ';
trimmed = trimmed.trim(); // returns 'foo'
// ES5 also allows for access to characters at specific indices via the bracket notation
trimmed[0]; // returns "f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment