Currency localization example

node v13.14.0
version: 2.0.0
endpointsharetweet
// Node.JS implemented this with ICU: http://userguide.icu-project.org/i18n // There are a lot of implementation of this in a lot of other platforms too. console.log(new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(100000)); console.log(new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', notation: 'compact' }).format(100000)); console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(100000)); console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY', notation: 'compact' }).format(100000)); console.log(new Intl.NumberFormat('zh-TW', { style: 'currency', currency: 'TWD' }).format(100000)); console.log(new Intl.NumberFormat('zh-TW', { style: 'currency', currency: 'TWD', notation: 'compact' }).format(100000));
Loading…

no comments

    sign in to comment