跳到主要内容

toDecimalMark

TS JS Deno

Converts a number to a decimal mark formatted string.

Use Number.prototype.toLocaleString() to convert the number to decimal mark format.

typescript
const toDecimalMark = (num: number) => num.toLocaleString("en-US");
typescript
toDecimalMark(12305030388.9087); // "12,305,030,388.909"