Test name | Executions per second |
---|---|
Intl.NumberFormat | 33345.9 Ops/sec |
Number.toLocaleString | 36175.2 Ops/sec |
const currencyPlayNumber = 1;
const translatedString = new Intl.NumberFormat(undefined, {
style: 'currency',
currency: 'RUB',
}).format(currencyPlayNumber);
const currencyPlayNumber = 1;
const translatedString = currencyPlayNumber.toLocaleString(undefined, {
style: 'currency',
currency: 'RUB',
})