var obj = { a: \"A\", b: \"B\", c: \"C\" } console.log(obj.a); // return string : A
but i want to get by through a variable like this
Use this syntax:
obj[name]
Note that obj.x is the same as obj["x"] for all valid JS identifiers, but the latter form accepts all string as keys (not just valid identifiers).
obj.x
obj["x"]
obj["Hey, this is ... neat?"] = 42