What do you do to format 1000 to 1,000 using Javascript? If you are a programmer, you may write a custom function to find length of the number and insert commas at required places. Numeral.js makes this task easy for you. It is a pure Javascript library for formatting and manipulating numbers. It does not have any dependencies and therefore it is very fast and right to the point.
Numeral.js Features
- It is a pure Javascript library and does not depend on any other libraries like jQuery.
- You can download and use the library from your own server or you can directly use the cdn link hosted in cdnjs.com
- You can also install the library in node.js
- Formatting a number is as easy as calling the format function with needed format given as argument. Visit the source link to know complete details of formatting options.
- The library can easily handle currencies, bytes, percentages and time. It can also unformat a formatted string back to number
- The library also includes ready made functions to add, subtract, multiply and divide