0

I have this object returned in this way:

Object: {
    "data":"data1",
    "value":"value1, value2"
}

If i just call using Object.value it will return both values. Right now I want to access value1 and value2 separately and assign them to a separate variable. E.g var first = value1, var second = value2. How can I achieve this?

Falady
  • 124
  • 1
  • 15
  • 1
    The value of the property is the single string `"value1, value2"`. If you want those separately, you have to split the string into multiple parts (such as an array). See the linked question's answers for how to do that. – T.J. Crowder Apr 20 '21 at 05:48
  • Thanks for the quick solution. Forgot about the split function – Falady Apr 20 '21 at 05:58

0 Answers0