自实现string的trim()方法
2017-05-28 本文已影响12人
SmallTwo
~function(pro){
function mytrim() {
return this.replace(/^ +| +$/g,'');
}
pro.mytrim = mytrim;
}(String.prototype);
~function(pro){
function mytrim() {
return this.replace(/^ +| +$/g,'');
}
pro.mytrim = mytrim;
}(String.prototype);