[JavaScript] String.prototype.trim()

Yuri Lee·2021년 8월 30일
0

String.prototype.trim()

  • trim() 메서드는 문자열 양 끝의 공백을 제거한다.
  • 공백이란 모든 공백문자(space, tab, NBSP 등)와 모든 개행문자(LF, CR 등)를 의미한다.

Example

const greeting = '   Hello world!   ';

console.log(greeting);
// expected output: "   Hello world!   ";

console.log(greeting.trim());
// expected output: "Hello world!";

https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/String/Trim

profile
Step by step goes a long way ✨

0개의 댓글