javascript rupiah format

Solutions on MaxInterview for javascript rupiah format by the best coders in the world

showing results for - "javascript rupiah format"
Beatrice
12 Jun 2016
1const numb = 1000000;
2const format = numb.toString().split('').reverse().join('');
3const convert = format.match(/\d{1,3}/g);
4const rupiah = 'Rp ' + convert.join('.').split('').reverse().join('')
5
6console.log(rupiah)
Alexander
30 Mar 2020
1const formatter = new Intl.NumberFormat('en-ID', {
2  style: 'currency',
3  currency: 'IDR'
4}).format(10000000)
5.replace(/[IDR]/gi, '')
6.replace(/(\.+\d{2})/, '')
7.trimLeft()
8
9console.log(`Rp ${formatter}`)