手写字符串 trim 方法 保证兼容性

String.prototype.myTrim = function () {
          return this replace(/^\s+/, '').replcae(/\s+$/, '')        
}    

 

posted @ 2020-09-01 02:52  凉城i  阅读(213)  评论(0编辑  收藏  举报