Sometimes, we want to remove double quotes from default string with JavaScript.
In this article, we’ll look at how to remove double quotes from default string with JavaScript.
How to remove double quotes from default string with JavaScript?
To remove double quotes from default string with JavaScript, we can use the string replace
method.
For instance, we write:
const test = ""House"";
const s = test.replace(/"/g, "");
console.log(s)
to call test.replace
with /"/g
and an empty string to replace all double quotes with empty strings.
Therefore, s
is 'House'
.
Conclusion
To remove double quotes from default string with JavaScript, we can use the string replace
method.