Add the method of of to remove the left and right Spaces for String objects in Javascript
- 2020-03-30 00:39:26
- OfStack
As follows:
String. The prototype. The trim = function () {
Var m = this match (/ ^ \ s * (\ s + (\ s + \ s +) *) \ s * $/);
Return (m = = null)?" ": m [1];
}
Use:
Var Message = " I'm fine ";
Message. The trim ();