“JavaScript Rupiah Format” Code-Antworten

JavaScript Rupiah Format

const numb = 1000000;
const format = numb.toString().split('').reverse().join('');
const convert = format.match(/\d{1,3}/g);
const rupiah = 'Rp ' + convert.join('.').split('').reverse().join('')

console.log(rupiah)
Sore Starling

JavaScript -Format Rupiah

const formatter = new Intl.NumberFormat('en-ID', {
  style: 'currency',
  currency: 'IDR'
}).format(10000000)
.replace(/[IDR]/gi, '')
.replace(/(\.+\d{2})/, '')
.trimLeft()

console.log(`Rp ${formatter}`)
Restu Wahyu Saputra

Ähnliche Antworten wie “JavaScript Rupiah Format”

Fragen ähnlich wie “JavaScript Rupiah Format”

Weitere verwandte Antworten zu “JavaScript Rupiah Format” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen