You’re reading the English version of this content since no translation exists yet for this locale. Help us translate this article!
The toLocaleString() method returns a string representing the object. This method is meant to be overridden by derived objects for locale-specific purposes.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
obj.toLocaleString()
Return value
A string representing the object.
Description
Object's toLocaleString returns the result of calling toString().
This function is provided to give objects a generic toLocaleString method, even though not all may use it. See the list below.
Objects overriding toLocaleString
Array:Array.prototype.toLocaleString()Number:Number.prototype.toLocaleString()Date:Date.prototype.toLocaleString()
Specifications
Browser compatibility
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.
Update compatibility data on GitHub
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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