Javascript 천 단위 구분 기호

이승훈·2024년 6월 14일
const number = 1000;
console.log(number.toLocaleString("ko-KR"));

toLocaleString 하는 대상은 문자열이 아닌 숫자여야 한다.
그래서 필요에 따라

Number(string).toLocaleString('ko-KR');

을 해야할 때도 있다.

profile
안녕하세요!

0개의 댓글