Format a number with thousands separators and optional decimal places
Provides locale-aware number formatting with thousands separators and configurable decimal precision.
Number to format
Optional
Optional number of decimal places to display
Formatted number string with separators
formatNumber(1234567) // "1,234,567"formatNumber(1234.5678) // "1,234.568" (locale dependent)formatNumber(1234.5678, 2) // "1234.57"formatNumber(999.999, 1) // "1000.0" Copy
formatNumber(1234567) // "1,234,567"formatNumber(1234.5678) // "1,234.568" (locale dependent)formatNumber(1234.5678, 2) // "1234.57"formatNumber(999.999, 1) // "1000.0"
Format a number with thousands separators and optional decimal places
Provides locale-aware number formatting with thousands separators and configurable decimal precision.