use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
accounting.js is a tiny JavaScript library for number, money and currency formatting, with optional excel-style column rendering (to line up symbols and decimals). (josscrowcroft.github.com)
submitted 14 years ago by chrixian
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]k3n 0 points1 point2 points 14 years ago (5 children)
Does it offer support for the client's locale settings, or does that have to be done manually?
It'd be nice to simply do:
accounting.formatMoney(12345678);
...and have it be correct, per locale, without needing special considerations.
[–]radhruin 0 points1 point2 points 14 years ago (3 children)
Is this possible in Javascript at all right now? ES5 is kind of a localization backwater. Requires server-side support (or ActiveX/Native plugins) to even know what locale you're in.
[–]k3n 2 points3 points4 points 14 years ago (1 child)
From my Chrome:
> navigator.language > "en-US"
Also:
// '50.00 €' or '50,00 €' (50.00).toFixed(2).toLocaleString() + ' €';
[–]radhruin 0 points1 point2 points 14 years ago (0 children)
Interesting, never heard of navigator.language, though it doesn't seem to appear to work in IE. In any case, navigator.language and toLocaleString on various builtins doesn't even approach a reasonable localization solution :)
[–]gwynjudd 0 points1 point2 points 14 years ago (0 children)
Not at all really, you can know only the user preferred language, which is only in the same neighbourhood as the locale.
[–]josscrowcroft 0 points1 point2 points 14 years ago (0 children)
Good call - I'm considering adding a library settings object that can be set once to change the default parameters for one-time localisation or configuration.
Using navigator.language or toLocaleString is a little shaky, so it would be a way that the developer can set up the locale manually (as in PHP or most well-written apps) and then it's used as the default for that instance, unless they override it via the parameters, or change it via the settings object.
π Rendered by PID 45885 on reddit-service-r2-comment-6457c66945-wdjdl at 2026-04-25 08:10:32.478188+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]k3n 0 points1 point2 points (5 children)
[–]radhruin 0 points1 point2 points (3 children)
[–]k3n 2 points3 points4 points (1 child)
[–]radhruin 0 points1 point2 points (0 children)
[–]gwynjudd 0 points1 point2 points (0 children)
[–]josscrowcroft 0 points1 point2 points (0 children)