Number.formatCurrency()
30/12/2019 by Capy

Front.id

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!

Tags

Add new comment

The content of this field is kept private and will not be shown publicly.

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.