Sometimes I have to format a number to a particular currency, and because this ans since it became a very common task over the years I have decided to create a function to simplify this task.
Number.formatCurrency() is a prototype, so you can simply use it over a number like 100000.formatCurrency()
It supports a series of arguments that allow you to control the type of currency, whether or not it shows the currency symbol and the language in which you want the formatting.
Without further ado, I leave you a page with the demo and the repository.
Repo: https://github.com/frontid/formatCurrency
Bye!
Add new comment