format currency to number javascript code example
Example 1: how to format money as currency string
(12345.67).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
Example 2: tofixed currency in js
(12345.67).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
Example 3: javascript format price
const number = 123456.789;
console.log(new Intl.NumberFormat('ja-JP', {
style: 'currency',
currency: 'BWP',
}).format(number));
Example 4: javascript number format indian currency
(1234567.8).toFixed(2).replace(/(\d)(?=(\d{2})+\d\.)/g, '$1,')