1formatPrice(value) {
2 let val = (value / 1).toFixed(2).replace('.', ',')
3 return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".")
4 }
1// Javascript has a number formatter (part of the Internationalization API).
2
3const number = 123456.789;
4
5// another example
6console.log(new Intl.NumberFormat('ja-JP', {
7 style: 'currency',
8 currency: 'BWP',
9}).format(number));
10
11// MORE INFO -> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
12
13