Using Js Remove Comma from Number from Existing Data

Using js remove comma from number from existing data

Use Array.prototype.map() and String.prototype.replace()
to modify the property Total:

var data = [{"Date": "2018-03-20", "Total": "10,459"},{"Date": "2018-03-21", "Total": "11,947"},{"Date": "2018-03-22", "Total": "12,932",}];
data = data.map(i => { i.Total = i.Total.replace(/,/g,''); return i;});console.log(data);

How to remove comma from number which comes dynamically in .tpl file

var a='1,125';
a=a.replace(/\,/g,''); // 1125, but a string, so convert it to number
a=parseInt(a,10);

Hope it helps.

remove comma separation from the specific number from JS

You can simplify the regular expression:

num.replace(/,/g, '')

How to remove comma if there is no next value

might not be the most elegant solution but you could add the comma only if defined using the ternary operator

    const obj = {
address1: "15th street",
state: "NY",
zip_code: 12345
}
obj.address1 = obj.address1 + ', ' + (obj.city ? obj.city + ', ' : '') + (obj.state ? obj.state + ', ' : '') + obj.zip_code;
console.log(obj.address1)

Take commas from input field, remove them, and store value with remove comma in different value

You can use replace() function to remove certain string from string.