Today I Learned

hashrocket A Hashrocket project

JavaScript Trim

The ES5 specification defined a new native method, trim(). It works just like Ruby's strip:

'   value   '.trim()
=> "value"

This is great for stripping extra whitespace from a user's input.

See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.