Skip to content
Advertisement

i want to remove coma and plus (+) operator from a string

I want to remove plus(+) sign and coma from a string. here is the code.

actualValue.push(parseFloat(wholeValues[i].replace(/,/g, '')))

Advertisement

Answer

You just need to replace twice.

const value = parseFloat(wholeValues[i].replaceAll(',', '').replaceAll('+', ''))
actualValue.push(value)
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement