Number to decimal mark

OSCC · JavaScript, Math · Oct 22, 2020

Converts a number to a decimal mark formatted string.

  • Use Number.prototype.toLocaleString() to convert the number to decimal mark format.
const toDecimalMark = num => num.toLocaleString('en-US');
toDecimalMark(12305030388.9087); // '12,305,030,388.909'

Would you like to help us improve 30 seconds of code?Take a quick survey

Recommended snippets