Hello mates, Can anyone please tell me how can I first convert two comma separated string into number and then add them in javascript? So I want to add 2 string like: 1,245+34,78,236
Any sample code would be greatly appreciated. Thank you.
@ZeroKilledMar 03.2008 — #you may need to remove the comma separator before adding them, and important, convert them to number: <i> </i>var numa = '13,134'; var numb = '398,387,098';
function convertToNumber(n){ return Number(n.replace(/,/g, '')); }