var obj = {a:1,b:2};
var str = "a";
console.log(obj.str);
This outputs undefined. What am i missing here ?
var obj = {a:1,b:2};
var str = "a";
console.log(obj.str);
This outputs undefined. What am i missing here ?
 
    
    You need to use []
var obj = {a:1,b:2};
var str = "a";
console.log(obj[str]);
