Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript object get value by key

var obj = {
   a: "A",
   b: "B",
   c: "C"
}

console.log(obj.a);  // return string : A

var name = "a";
console.log(obj[name]);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #object #key
ADD COMMENT
Topic
Name
2+5 =