Name

Array.toLocaleString() — convert an array to a localized string

Inherits from

Overrides Object.toLocaleString()

Synopsis

array.toLocaleString()

Returns

A localized string representation of array.

Throws

TypeError

If this method is invoked on an object that is not an Array.

Description

The toLocaleString() method of an array returns a localized string representation of an array. It does this by calling the toLocaleString() method of all of the array elements, then concatenating the resulting strings using a locale-specific separator character.

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.