js tools
js format currency
How to Format a Number as Currency in JavaScript
function formatDollarValue(value) {
value=Number(value);
return '$' + value.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
function formatCurrency(val) {
return val.toLocaleString('en-US', {
style: 'currency',
currency: 'USD'
});
}
// 中国元
// num.toLocaleString("zh-CN", {style:"currency", currency:"CNY"});