Skip to content
Advertisement

How do I format numbers to add space on thousandth and none on ten thousandth etc

Let me show that in an example:

What it is:

JavaScript

What I want:

JavaScript

Also I wasn’t sure how to name the question. Any suggestions?

Advertisement

Answer

You can use something like in below snippet.

Define a width and text-align to the right

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement