I just updated to Node v8.0 and noticed that Number.prototype.toLocaleString() with options style: 'currency'
and also currency
set to any currency behaves differently than any other environment. In Node v7.2.1 and also Chrome v58.0 my output would look like $5.00
, but in Node 8 it's showing with different currency symbol and extra space as US$ 5.00
. Is this just an update? Where would I find docs for this? Did Node just decide to update toLocaleString
and it should be treated as a function that changes based on environment?
const value = 5
value.toLocaleString('en-US', { style: 'currency', currency: 'USD' })
Node 8.0
'US$ 5.00'
Node < 8.0 + Chrome
'$5.00'
via user7128475
No comments:
Post a Comment