Test name | Executions per second |
---|---|
Intl.NumberFormat | 37541.8 Ops/sec |
Number.toLocaleString | 41670.0 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',
})