Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
Created January 29, 2017 07:36
Show Gist options
  • Save davidgilbertson/963c3bcc9f6d96554b7aa6a96525dd8c to your computer and use it in GitHub Desktop.
Save davidgilbertson/963c3bcc9f6d96554b7aa6a96525dd8c to your computer and use it in GitHub Desktop.
const price = 1234.567;
const formattedPrice = price.toLocaleString('en', {
style: 'currency',
currency: 'USD'
});
console.log(formattedPrice); // "$1,234.57"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment