Formats a number using the local number format order.
- Use
Number.prototype.toLocaleString()
to convert a number to using the local number format separators.
代码实现
const formatNumber = num => num.toLocaleString();
formatNumber(123456); // '123,456' in `en-US`
formatNumber(15675436903); // '15.675.436.903' in `de-DE`