The question says it all; JS doesn\'t seem to have a native trim() method.
Microsoft .NET also has String.trim function as a part of JavaScript Base Type Extensions. It could be used if you are coding ASP.NET application.