JavaScript字符串去除空格

/*字符串去除空格*/
String.prototype.Trim = function() {
    return this.replace(/(^s*)|(s*$)/g, "");
}
String.prototype.LeftTrim = function() {
    return this.replace(/(^s*)/g, "");
}
String.prototype.RightTrim = function() {
    return this.replace(/(s*$)/g, "");
} 
原文地址:https://www.cnblogs.com/YuanSong/p/3877961.html