You may be annoyed if you are used to a convenient trim function on your strings that eliminates leading and trailing whitespace and you've found that it doesn't exist in javascript.
Here's a quick fix:
//start code
// add the missing trim functions
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };
//end code
Add this in any javascript file or in between some <script> tags and your javascript strings will magically have the trim function.
This is because javascript classes are mutable. There is a more accurate and technical explanation but I will spare you the pain.
We are simply adding the trim function to the string class at runtime. The trim function uses regular expressions to trim the string of leading and trailing whitespace.