Nest all content into snippets

This commit is contained in:
Angelos Chalaris
2023-05-07 16:07:29 +03:00
parent 2ecadbada9
commit 6a45d2ec07
1240 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,21 @@
---
title: Format number
type: snippet
language: javascript
tags: [string,math]
cover: laptop-plants
dateModified: 2020-10-22T20:23:47+03:00
---
Formats a number using the local number format order.
- Use `Number.prototype.toLocaleString()` to convert a number to using the local number format separators.
```js
const formatNumber = num => num.toLocaleString();
```
```js
formatNumber(123456); // '123,456' in `en-US`
formatNumber(15675436903); // '15.675.436.903' in `de-DE`
```