Remove quotes in javascript


I am getting data in a variable as ""Value"". So, I want to remove quotes but only inner quotes.
I tried with this but it’s not working.

var value = "fetchedValue";
value = value.replace(/\"/g, "");

Can anyone explain with an example?

expected = "Value"


It’s weird. Your solution should work.
Well, try this:

var value = "fetchedValue";
value = value.slice(1, -1);

Answered By – Sagar Chaudhary

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published