showing results for - "javascript format rupiah"
Julián
26 Aug 2019
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)
Alex
10 Jan 2017
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}`)