Simple way to format currency with Javascript accounting.js

accounting.js is a tiny JavaScript library for number, money and currency formatting, with optional excel-style column rendering (to line up symbols and decimals). It’s lightweight, fully localisable and has zero dependencies. These library has settings like

  • symbol : “$”, // default currency symbol is ‘$’
  • format: “%s%v”, // this controls string output: %s = symbol, %v = value/number
  • decimal : “.”, // decimal point separator
  • thousand: “,”, // thousands separator
  • precision : 2 // decimal places

Usage of this library is  simple as show below,

Just include the library in your web application and trigger the above shown code with your value.

Requirement :- accounting.js
Demo :-
License :- GPL License

Leave a Comment

Your email address will not be published. Required fields are marked *