Task References

On this page:



The toLocaleString task is used to convert the elements of a given array to a locale string. The elements are often separated by a locale-specific string. The result of calling this task is similar to the toString method, except this task is locale-specific.

Potential Use Case

This task is typically used to specify a language-specific format for dates, time, numbers, objects and arrays. Let's say you need to format currency such as "USD" for the US dollar, "EUR" for the euro, or "INR" for the Indian Rupee. You could use the toLocaleString task to display the currency in the appropriate format and symbol that represents the locale that should be used.


Input and output parameters are shown below.

Input Type Description
arr Array Required. The array to convert.
locales Array Required. A string that holds a BCP 47 language tag, or an array of such language tags. If the locales parameter is not provided or is undefined, the default locale is used.
options Object Required. An object with configuration properties. For number objects, use Number.prototype.toLocaleString(). For date objects, use Date.prototype.toLocaleString().

Output Type Description
elementString String A string representing the elements of the array.


In the IAP examples shown below:

  • All the incoming variables for toLocaleString are required.


  • In the examples shown below, toLocaleString is used to convert numbers into a locale-specific currency representation (i.e., Euro, USD). The elementString (output variable) of each example is shown in the Task History, which is accessed from Job Manager.

    Example: Euro



    Example: USD



Additional Information

For more information on using the locales parameter, see the Intl page on the MDN site.