Add the method of of to remove the left and right Spaces for String objects in Javascript
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 ();