18 Oct formater les nombres en devise
Pour formater les nombres avec les conditions de formatage locales, vous pouvez utiliser la méthode toLocaleString ().
var data = 1000000;
data.toLocaleString('en-US')
// 1,000,000
data.toLocaleString('it-IT')
// 1.000.000
data.toLocaleString('it-IT', {style: 'currency', currency: 'EUR'})
// → 1.000.000,00 €
data.toLocaleString('it-IT', {style: 'currency', currency: 'USD'})
// → 1.000.000,00 US$
data.toLocaleString('en-US', {style: 'currency', currency: 'EUR'})
// → €1,000,000.00
data.toLocaleString('en-US', {style: 'currency', currency: 'USD'})
// → $1,000,000.00