JavaScript/Built-in Method etc.

String.prototype.trim()

감공사 2020. 8. 10. 23:21
728x90

✨ string의 양쪽 공백을 모두 없애주는 build-in method

💻Example Code

실행 결과

🧨 Client에게 무언가 입력을 받은 후 실수로 채워진 공백을 지울 때 유용하게 사용 가능하다.

👉 자세한 내용은 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim

 

String.prototype.trim()

The trim() method removes whitespace from both ends of a string. Whitespace in this context is all the whitespace characters (space, tab, no-break space, etc.) and all the line terminator characters (LF, CR, etc.).

developer.mozilla.org