How to replace the "" in "Hello" with .replace()?

This only replaces the first ", but not the one at the end of a word

partFormatted = partFormatted.replace("\"", "");

>Solution :

Something I didn’t see in the other post is using a regular expression.
Specifically the global flag.

partFormatted = partFormatted.replace(/"/g, "");

The ‘g’ indicates it should find all given matches and replace with given input

Leave a Reply