6 lines
121 B
TypeScript
6 lines
121 B
TypeScript
|
|
|
|
export function numberWithCommas(x: number): string {
|
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
}
|