# 3-digit delimited comma

**URL:** <https://community.hubspot.com/t/3-digit-delimited-comma/78908>\
**Category:** CMS Development\
**Tags:** enterprise\
**Created:** [April 7, 2023, 12:07pm UTC](https://community.hubspot.com/t/3-digit-delimited-comma/78908 "2023-04-07T12:07:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishizaka](https://avatars.discourse-cdn.com/v4/letter/i/aeb1de/32.png) [@ishizaka](https://community.hubspot.com/u/ishizaka)\
**Post date:** [April 7, 2023, 12:07pm UTC](https://community.hubspot.com/t/3-digit-delimited-comma/78908/1 "2023-04-07T12:07:08Z")

</div>

I would like to know how to output a number set in a numeric field with a comma separating the three digits.

---

<div class="post-metadata">

**Author:** ![ankitparmar09](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ankitparmar09/32/64399_2.png) [@ankitparmar09](https://community.hubspot.com/u/ankitparmar09)\
**Post date:** [April 7, 2023, 12:31pm UTC](https://community.hubspot.com/t/3-digit-delimited-comma/78908/2 "2023-04-07T12:31:16Z")

</div>

Hello @ishizaka

Thanks for reaching out. Good question. You can use the following code, it can help you.

`var number = {{ module.number_field }};document.body.innerHTML = number.toLocaleString();// 1,557,564,534`

---

<div class="post-metadata">

**Author:** ![ankitparmar09](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ankitparmar09/32/64399_2.png) [@ankitparmar09](https://community.hubspot.com/u/ankitparmar09)\
**Post date:** [April 7, 2023, 1:02pm UTC](https://community.hubspot.com/t/3-digit-delimited-comma/78908/3 "2023-04-07T13:02:50Z")

</div>

Hello @ishizaka

Thanks for reaching out. Good question. You can use the following code, it can help you.

`var number = {{ module.number_field }};document.body.innerHTML = number.toLocaleString();// 1,557,564,534`

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [April 7, 2023, 2:00pm UTC](https://community.hubspot.com/t/3-digit-delimited-comma/78908/4 "2023-04-07T14:00:58Z")

</div>

Hello @ishizaka

To output a number with a comma separating the thousands, you can use the `toLocaleString()` method in JavaScript.

Here’s an example:

```lia-code-sample
const number = 1234567.89;
const formattedNumber = number.toLocaleString(); // "1,234,567.89"

```

The `toLocaleString()` method formats the number according to the locale and options specified, so the output may vary depending on the user’s language and region settings.

You can also specify the locale explicitly, like this:

```lia-code-sample
const number = 1234567.89;
const formattedNumber = number.toLocaleString('en-US'); // "1,234,567.89"

```

In this example, `'en-US'` specifies the locale as English (United States).

If you want to use a different character as the delimiter, you can specify it as an option:

```lia-code-sample
const number = 1234567.89;
const options = { 
 useGrouping: true, 
 minimumFractionDigits: 2, 
 maximumFractionDigits: 2, 
 minimumIntegerDigits: 1, 
 style: 'currency', 
 currency: 'USD',
 currencyDisplay: 'symbol',
 numberingSystem: 'latn', // use latin digits
 notation: 'compact',
 compactDisplay: 'short',
 signDisplay: 'auto' 
};
const formattedNumber = number.toLocaleString('en-US', options); // "$1.2M"

```

In this example, the `options` object specifies various options for formatting the number, including `useGrouping: true` to enable grouping with a comma delimiter. The `currency` option is set to `'USD'` to format the number as a US dollar currency value.

You can adjust the options to format the number according to your specific needs.
