Forums

Full Version: Convert number to comma separated format
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to convert a number to comma separated format? 

Add this in connection script

function numberWithCommas(x) {
     return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}


var cost = changedItem.attributes.data[0].cost_amount;
var cost_comma=numberWithCommas(cost);