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);
More Related Contents:
- How do I make the first letter of a string uppercase in JavaScript?
- Trim string in JavaScript?
- How to check if a string “StartsWith” another string?
- How to count string occurrence in string?
- Fastest method to replace all instances of a character in a string [duplicate]
- Evaluating a string as a mathematical expression in JavaScript
- How can I use backslashes (\) in a string?
- Strip all non-numeric characters from string in JavaScript
- What is the correct way to check for string equality in JavaScript?
- Convert string with commas to array
- Check for special characters in string
- String to object in JS
- Contains case insensitive
- Regular expression which matches a pattern, or is an empty string
- Finding all indexes of a specified character within a string
- How to build query string with Javascript
- javascript regular expression to check for IP addresses
- Replace all spaces in a string with ‘+’ [duplicate]
- Passing regex modifier options to RegExp object
- How do I split a string into an array of characters? [duplicate]
- How to check if a string array contains one string in JavaScript? [duplicate]
- How to convert hex string into a bytes array, and a bytes array in the hex string?
- Get the weekday from a Date object or date string using JavaScript
- Determine if string is in list in JavaScript
- How to get the day of the week from the day number in JavaScript?
- Are ES6 template literals faster than string concatenation?
- Javascript / Jquery – Get number from string
- How to test if a URL string is absolute or relative?
- Split a string, at every nth position, with JavaScript? [duplicate]
- Javascript – Replacing the escape character in a string literal