Cannot access property via dot notation javascript -
this question has answer here:
var obj = {a:1,b:2}; var str = "a";  console.log(obj.str);   this outputs undefined. missing here ?
you need use []
var obj = {a:1,b:2}; var str = "a";  console.log(obj[str]);      
Comments
Post a Comment