Skip to content

Instantly share code, notes, and snippets.

@shisama
Last active April 23, 2019 17:36
Show Gist options
  • Save shisama/d10e13474bb4a035f59f992d166be7f5 to your computer and use it in GitHub Desktop.
Save shisama/d10e13474bb4a035f59f992d166be7f5 to your computer and use it in GitHub Desktop.
Intl.ListFormat - New JavaScript Features in Node.js v12
const vehicles = ['Motorcycle', 'Bus', 'Car'];
{
const formatter = new Intl.ListFormat('ja', { style: 'long', type: 'conjunction' });
console.log(formatter.format(vehicles));
// expected output: "Motorcycle、Bus、Car"
}
{
const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' });
console.log(formatter.format(vehicles));
// expected output: "Motorcycle, Bus, and Car"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment