Commas messing with number input in Javascript

Use a global regular expression to replace all commas with an empty string:

var str = "12,345,678";
str = str.replace(/,/g, "");
parseInt(str, 10);

Leave a Comment