Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2universalStack: javascript
i18nnumbersformatting
Format numbers with toLocaleString for broad support
Prefer Number.prototype.toLocaleString over hand-built Intl.NumberFormat instances for simple locale-aware grouping; wider support and simpler.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | const formatted = new Intl.NumberFormat('fr-FR').format(pageViews); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const formatted = pageViews.toLocaleString(); |
Explanation (EN)
Objašnjenje (HR)