Object.prototype.toLocaleString()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2017.
toLocaleString()
메서드는 객체로 된 문자열을 반환합니다. 이 메서드는 지역별로 다른 객체로 재정의되어 표시됩니다.
시도해보기
const date1 = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log(date1.toLocaleString("ar-EG"));
// Expected output: "٢٠/١٢/٢٠١٢ ٤:٠٠:٠٠ ص"
const number1 = 123456.789;
console.log(number1.toLocaleString("de-DE"));
// Expected output: "123.456,789"
구문
js
obj.toLocaleString();
반환 값
객체를 나타내는 문자열.
설명
Object
의 toLocaleString
은 toString()
을 호출 한 결과를 반환합니다.
이 함수는 모든 객체가 사용할 수는 없지만 객체에 일반 toLocaleString
메소드를 제공하기 위해 제공됩니다. 아래 목록을 참조하십시오.
toLocaleString()
을 재정의하는 객체
명세
Specification |
---|
ECMAScript® 2025 Language Specification # sec-object.prototype.tolocalestring |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
toLocaleString |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.