- Instant help with your JavaScript coding problems

Remove double quotes from a string in JavaScript

Question:
How to remove double quotes from a string in JavaScript?
Answer:
const originalStr = 'This is a "special" text';
const cleanedStr = originalStr.replace(/"/g, ''); // 'This is a special text' 
Description:

To remove double quotes " from a string in JavaScript, you can use the replace method with a basic regular expression: /"/g

If you don't prefer regular expressions you can use the replaceAll method by simply defining the character you want to remove and an empty string as a replacement:

originalStr.replaceAll('"', '')
Share "How to remove double quotes from a string in JavaScript?"
Related snippets:
Tags:
remove, double, quotes, string, text, javascript
Technical term:
Remove double quotes from a string in JavaScript