no string in javascript method trim
Clear empty string method before and after the string
1 can be used out of the way each character deleted
2 can use regular expressions
var regExp=/^/s*(.*?)/s*$/;
var returnValue=" testss ".replace(regExp,"$1");
Take the first $ n n takes several matching 1-9
$ Nn nn taken 01--99
Of course, the trim method may be utilized jquery