Document how to format number with local

Relates to #201
This commit is contained in:
Ariel Barreiro 2024-02-16 11:03:35 -03:00 committed by GitHub
parent 387ef33f94
commit b368810ecc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -92,6 +92,13 @@ _format = format # store reference to the built in format
format(x) = _format(x, {notation:"exponential"}) format(x) = _format(x, {notation:"exponential"})
``` ```
You can also do something like this to show the number with your default locale or providing a [custom one](https://www.w3.org/International/articles/language-tags/):
```
format(x) = x.toLocaleString();
format(x) = x.toLocaleString('en-GB');
```
See the [Math.js format()](https://mathjs.org/docs/reference/functions/format.html) function for more info on what's supported. See the [Math.js format()](https://mathjs.org/docs/reference/functions/format.html) function for more info on what's supported.