0

I have a list

 var Names = '["john", "adam"]';

I want to remove the string to make it a list.

My resultant output:

  var Names = ["john", "adam"];
2
  • var Names = JSON.parse('["john", "adam"]'); This should work Commented Mar 31, 2020 at 16:08
  • Try and explore JSON.parse Commented Mar 31, 2020 at 16:08

1 Answer 1

1

Use JSON.parse

console.log(JSON.parse('["john", "adam"]'))

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.