I'm trying to format a number using the Intl.NumberFormat.
I have checked MDN WebDocs but I'm not able to get the response I guess it should return.
I'm formatting with spanish locale, and I want to get the point separator between thousands (using useGrouping
option), however, I'm not getting it
- Expected result: 1.124,50 €
- Obtained result: 1124,50 €
var sNumber = '1124.5'
var number = new Number(sNumber);
let style = {
style: 'currency',
currency: "EUR",
minimumFractionDigits: 2,
useGrouping: true
};
const formatter = new Intl.NumberFormat("es", style);
console.log(formatter.format(number));