Format a number with specified decimal places
Similar to formatNumber but always returns a string with exact decimal places, without locale-based thousands separators.
Number to format
Exact number of decimal places to display
Formatted number string with fixed decimals
formatNumberWithDecimals(1234.5678, 2) // "1234.57"formatNumberWithDecimals(99.5, 3) // "99.500"formatNumberWithDecimals(1000, 0) // "1000" Copy
formatNumberWithDecimals(1234.5678, 2) // "1234.57"formatNumberWithDecimals(99.5, 3) // "99.500"formatNumberWithDecimals(1000, 0) // "1000"
Format a number with specified decimal places
Similar to formatNumber but always returns a string with exact decimal places, without locale-based thousands separators.