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`
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️