Answers for "convert int to currency javascript"

6

format amount in javascript

const formatToCurrency = amount => {
  return "$" + amount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, "$&,");
};
formatToCurrency(12.34546); //"$12.35"
formatToCurrency(42345255.356); //"$42,345,255.36
Posted by: Guest on December-30-2019
9

how to format money as currency string

(12345.67).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');  // 12,345.67
Posted by: Guest on February-23-2020
1

javascript format price

// Javascript has a number formatter (part of the Internationalization API).

const number = 123456.789;

// another example 
console.log(new Intl.NumberFormat('ja-JP',  {
  style: 'currency',
  currency: 'BWP',
}).format(number));

// MORE INFO ->  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
Posted by: Guest on July-06-2020

Code answers related to "convert int to currency javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language