# Add comma in array

**URL:** <https://discourse.nodered.org/t/add-comma-in-array/70899>\
**Category:** General\
**Created:** [20 November 2022 06:34 UTC](https://discourse.nodered.org/t/add-comma-in-array/70899 "2022-11-20T06:34:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dowermyr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dowermyr/32/31547_2.png) [@dowermyr](https://discourse.nodered.org/u/dowermyr)\
**Post date:** [20 November 2022 06:34 UTC](https://discourse.nodered.org/t/add-comma-in-array/70899/1 "2022-11-20T06:34:13Z")

</div>

Hi!  
How do i divide a value in an array, and keep one decimal ?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/d/fdb8d0c3e24933211d188efbd10f49cc09c89067.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2022 07:46 UTC](https://discourse.nodered.org/t/add-comma-in-array/70899/2 "2022-11-20T07:46:13Z")

</div>

It is generally best not to throw away accuracy until you need to, so don't do this until you are going to display it. When you need to display it, often the display widget will allow you to do this in the widget. Otherwise you can use toFixed() in a function node to convert the number to a string with the required resolution.

---

<div class="post-metadata">

**Author:** ![dowermyr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dowermyr/32/31547_2.png) [@dowermyr](https://discourse.nodered.org/u/dowermyr)\
**Post date:** [21 November 2022 10:12 UTC](https://discourse.nodered.org/t/add-comma-in-array/70899/3 "2022-11-21T10:12:17Z")

</div>

Hi! Do you have an example of how to do this?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [21 November 2022 10:35 UTC](https://discourse.nodered.org/t/add-comma-in-array/70899/4 "2022-11-21T10:35:36Z")

</div>

A good idea - when yo have a question about something like 'toFixed() is to do a google search using 'javascript toFixed()' and look at the explainations you find.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 January 2023 10:35 UTC](https://discourse.nodered.org/t/add-comma-in-array/70899/5 "2023-01-20T10:35:42Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
