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