Home > Article > Web Front-end > Javascript modifies the String object and adds the function of removing spaces (sample code)_javascript skills
String.prototype.LTrim = function () {
return this.replace(/(^s*)/g, "");
}
String.prototype.RTrim = function () {
return this.replace(/(s*$)/g, "");
}
//#endregion