Object.prototype.toLocaleString()

toLocaleString() 方法返回一个该对象的字符串表示。此方法被用于派生对象为了特定语言环境的目的(locale-specific purposes)而重载使用。

语法

obj.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 Latest Draft (ECMA-262)
Object.prototype.toLocaleString
Draft  

浏览器兼容性

Update compatibility data on GitHub
Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
toLocaleString Chrome Full support 1 Edge Full support 12 Firefox Full support 1 IE Full support 5.5 Opera Full support Yes Safari Full support Yes WebView Android Full support 1 Chrome Android Full support 18 Firefox Android Full support 4 Opera Android Full support Yes Safari iOS Full support Yes Samsung Internet Android Full support 1.0 nodejs Full support Yes

Legend

Full support  
Full support

相关链接