您的位置:首页 > Web前端 > JavaScript

Js string 添加trim()方法

2012-06-23 21:20 239 查看
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
};

String.method("trim", function () {
return this.replace(/^\s+|\s+$/g, "");
});


alert(" sss ".trim()+"xx");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: