utils.tothousand
Home > @nipem/utils > toThousand
toThousand() function
format a number to thousand points
Signature:export declare function toThousand(n: number, digits?: number): string;
Parameters
Parameter | Type | Description |
---|---|---|
n | number | number |
digits | number | (Optional) The number of digits to appear after the decimal point |
string
formatted string
Example
// digits default 0
toThousand(1234.5678) // 1,234.5678
// set digits to 2
toThousand(1234.5678, 2) // 1,234.57