Trimming Strings in JavaScript
ECMAScript 5 has support for String#trim, so next time you’re trimming a String in Node (or in a web browser if you don’t care about IE 8), you can trim it like:
instead of the dated regular expression approach:
Please (please!) use these when you can. I’ve got a really fun post coming up on ECMAScript 5 in more detail. Stay tuned!