Files
30-seconds-of-code/snippets/toDecimalMark.md
2020-04-16 23:07:33 +03:00

328 B

title, tags
title tags
toDecimalMark math,beginner

Converts a number to a decimal mark formatted string.

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

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