javascript.trim()

gamja·2022년 5월 5일

문자열의 공백을 지우는 .trim()

const greeting = '   Hello world!   ';

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

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

문자열의 좌우 공백을 지워준다.

profile
slow and steady

0개의 댓글