Scott
Scott

Reputation: 55

How do you get plural currency name with JS?

I know I can use Intl.DisplayNames to get the singular form (e.g. US Dollar).

const currencyNameEnUs = new Intl.DisplayNames( 'en-US', { type: 'currency' } );
const currencyCode = 'USD';

console.log( currencyNameEnUs.of( currencyCode ) );
// Expected output: "US Dollar"

But, I don't know how to pluralize the result. How do I get "US Dollars"?

Upvotes: 1

Views: 190

Answers (0)

Related Questions