I'm trying to learn javascript objects, starting with a very basic object and I cant get it to work. Can anyone tell me why the last console.log() comes back "undefined" instead of "Bill"??
const firstObject = {
name: "Bill",
profession: "Fireman",
age: 30,
getInfo: function (theInfo) {
console.log(theInfo);
console.log(this.name);
console.log(this.theInfo);
},
};
firstObject.getInfo("name");