Files
30-seconds-of-code/snippets/toDecimalMark.md
Angelos Chalaris dd9c96bbb5 Update descriptions for pad and toDecimalMark
Missing prototypes in the code explanations.
2020-03-06 09:58:07 +02:00

17 lines
336 B
Markdown

---
title: toDecimalMark
tags: utility,math,beginner
---
Converts a number to a decimal mark formatted string.
Use `Number.prototype.toLocaleString()` to convert the numbre to decimal mark format.
```js
const toDecimalMark = num => num.toLocaleString('en-US');
```
```js
toDecimalMark(12305030388.9087); // "12,305,030,388.909"
```