From 8e24fe9e98682073a3e7752ed206273e64e2973e Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Sun, 14 Jul 2024 13:17:16 +0200 Subject: [PATCH] Move Math blocks' format and toLocaleString() example from README into docs/ --- docs/index.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/index.md b/docs/index.md index ab7990dc..67ba2324 100644 --- a/docs/index.md +++ b/docs/index.md @@ -77,6 +77,14 @@ _format = format # store reference to the built in format format(x) = _format(x, {notation:"exponential"}) ``` +You can also do something like this to show the number with your default locale or provide 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. ## The buffer file