How can I format numbers as currency in JavaScript?

How can I format numbers as currency in JavaScript?

In a customer project I needed to format numbers as currency. In this case I found this neat little extension method.

In action it looks like this: 1'234.12 CHF

Here is the related Stack Overflow thread.

Thomas Bandixen's Picture

About Thomas Bandixen

Thomas Bandixen is a senior consultant, Microsoft Certified Trainer (MCT) and speaker working for the swiss IT service provider Trivadis AG. His primary focus is on modern web architectures using Angular, TypeScript, HTML5, CSS and ASP.NET Core.

Switzerland https://thomasbandixen.ch