Localized pricing with Intl.NumberFormat

If you need to show localized pricing in JS, Intl.NumberFormat() is incredibly handy.

Just give it your language, currency, amount, and some (optional) display options, and it will handle all the formatting for you.

let price = new Intl.NumberFormat('it-IT', {
  style: 'currency',
  currency: 'EUR', // USD, CAD, GBP, AUD, etc...
  currencyDisplay: 'symbol',
  minimumFractionDigits: 0
}).format(2.00),  

Thanks to Jonathan Reinink for inspiring this post: https://x.com/reinink/status/1798694253759181267

More info on MDN.