ie 7/8不支持trim的属性的解决方案
时间:2016-09-10 13:15:08
收藏:0
阅读:181
if(!(‘trim‘ in String.prototype)){ String.prototype.trim = function(){ return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,‘‘); } }
console.log(‘(‘ + ‘ aaa ‘.trim() + ‘)‘);
原文:http://www.cnblogs.com/gongshunkai/p/5859149.html
评论(0)