I have an object and I can reference key a
as in the following:
var obj = {
a: "A",
b: "B",
c: "C"
}
console.log(obj.a); // return string : A
I want to get the value by using a variable to reference the object key as below:
var name = "a";
console.log(obj.name) // this prints undefined, but I want it to print "A"
How can I do this?