프로그래밍/자바스크립트

trim 익스저버젼

기타 치는 개발자 2015. 1. 6. 18:33

if(typeof String.prototype.trim !== 'function') {

   String.prototype.trim = function() {

       return this.replace(/^\s+|\s+$/g, ''); 

   };

}