JavaScript 문자열 ltrim() 구현

1 개요[ | ]

자바스크립트 ltrim() 구현
JavaScript 문자열 ltrim() 구현
JavaScript
Copy
var str = "  HELLO  ".replace(/^\s+/,'');
console.log("("+str+")"); // (HELLO  )
(HELLO  ) 
JavaScript
Copy
String.prototype.ltrim = function(){return this.replace(/^\s+/,'');}
var str = "  HELLO  ";
console.log("("+str.ltrim()+")"); // (HELLO  )
(HELLO  ) 

2 같이 보기[ | ]