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 [] notation for string representations of properties:
[]
console.log(obj[name]);
Otherwise it's looking for the "name" property, rather than the "a" property.