The problem I am having is turning a String to an object reference. If I want to reference the answers object.
However, I have a string that references the letters in the answers object.
var objPosition = {
"question": "In Stuart times what punishment was given to wives who talked too much?",
"answers": {
"A": "Thumbs were squeezed in a vice",
"B": "Had to walk round in a barrel",
"C": "Wore an iron mask with a spike in the mouth"
},
"answer": "C",
"explanation": "N/A",
"type": "Stuart"
};
var a = "a";
console.log(objPosition.answers.a);
However I constantly get the undefined error, I am wanting to convert my String back into an object reference?