Answers for "format currency vietnam javascript"

3

javascript format currency

function formatToCurrency(amount){
    return (amount).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); 
}
formatToCurrency(12.34546); //"12.35"
formatToCurrency(42345255.356); //"42,345,255.36"
Posted by: Guest on July-12-2020
1

format currency javascript

const formatter = new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD',
  minimumFractionDigits: 2
})

formatter.format(1000) // "$1,000.00"
formatter.format(10) // "$10.00"


-----------------------------------------------------
const formatter = new Intl.NumberFormat('vi-VN', {
  style: 'currency',
  currency: 'VND',
  minimumFractionDigits: 0
})


$('.total-price').html(formatter.format(price)); // 25.000đ
Posted by: Guest on September-30-2021
0

javascript currency format

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


console.log(`Rp ${formatter}`)
Posted by: Guest on January-03-2021

Code answers related to "format currency vietnam javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language