I'm a bit new to JavaScript so I want to know how I can convert something like this :
var names = "{ guy:'Henry' guy2:'Joe' guy3:'Bob' }"
from a string into an actual object and then access the values of keys. I tried to use :
names = eval(names)
console.log(names.guy)
I'd get undefined and if i try :
console.log(names)
I'd get just the first value of the object which is 'Henry' Please can someone help me with this and if my question wasn't explanatory enough, i can make it clearer