0

I am trying to remove string Quotes mark but cant able to remove.

Ex: ['moe', 'larry', 'curly'], [30, 40, 50]

Need: ['moe', 'larry', 'curly'], [30, 40, 50]

Because I'm trying Underscore Object function(_.object).

Ex: _.object("['moe', 'larry', 'curly'], [30, 40, 50]")

Only I am getting undefined result.

3
  • 2
    Is it just a string? string.replace(/"/g, '') will do it if so Commented Apr 18, 2018 at 12:14
  • 1
    You should learn about types first. Your question does not really make sense and you already asked a very similar question. Commented Apr 18, 2018 at 12:15
  • 1
    Possible duplicate of I want to remove double quotes from a String Commented Apr 18, 2018 at 12:16

1 Answer 1

2

If you just want to remove double quotes, you can do it like this:

const quotes = "['moe', 'larry', 'curly'], [30, 40, 50]"; const noQuotes = quotes.replace(/\"/, ''); console.log(noQuotes);

/\"/ is a regular expression that matches any " in the string. You simply replace them with the empty string.

Sign up to request clarification or add additional context in comments.

2 Comments

I trying underscore function but its not working EX: _.object(noQuotes); getting only undefined
var quotes = "['moe', 'larry', 'curly'], [30, 40, 50]"; var noQuotes = quotes.replace(/\"/, ''); _.object(noQuotes) I am getting only "Undefined"

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.