toLocaleString()
方法返回一个该对象的字符串表示。此方法被用于派生对象为了特定语言环境的目的(locale-specific purposes)而重载使用。
语法
obj.toLocaleString();
返回值
表示对象的字符串。
描述
Object
toLocaleString
返回调用 toString()
的结果。
该函数提供给对象一个通用的toLocaleString
方法,即使不是全部都可以使用它。 见下面的列表。
覆盖 toLocaleString
的对象
规范
Specification | Status | Comment |
---|---|---|
ECMAScript 3rd Edition (ECMA-262) | Standard | Initial definition. |
ECMAScript 5.1 (ECMA-262) Object.prototype.toLocaleString |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) Object.prototype.toLocaleString |
Standard | |
ECMAScript (ECMA-262) Object.prototype.toLocaleString |
Living Standard |
浏览器兼容性
BCD tables only load in the browser
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.