Below is a simple Object I created in Javascript.
var obb = {name : "Charlie", Age : 28 , Location : "London" , Job : "Detective"} ;
var x = "name";
console.log(obb.name);
console.log(obb.x) ; //Dot notation :- returns value undefined
console.log(obb[x]); // Square bracket :- returns correct answer
I know that there are two methods to fetch values of objects i.e dot notation and square bracket.Now if I am storing value of property in a variable & using dot notation with the variable to fetch value , why is it not working ?