I create an object in the Chrome console with a function to increase the age. When I try and increase the age, I get "undefined" but I'm not sure why. Below is what I type into the console. As you can see the last line says undefined but it should say 41. Any thoughts?
>>obj = {}
Object {}
>>obj.firstName='John'
"John"
>>obj.lastName='Soro'
"Soro"
>>obj.age=40
40
>>obj.increaseAge = function() {
this.age++;
}
function () {
this.age++;
}
>>obj.lastName
"Soro"
>>obj.firstName
"John"
obj.increaseAge
function () {
this.age++;
}
obj.increaseAge()
undefined