What am I missing in the explanation?


Hi Folks. Please someone explain to me the purpose/value of the function/method new
Age. I totally deleted it from the code and still came up with the same answer '1997'. It seems to be included as an example of a method, but a meaningless method from what I can tell. Thanks.

var bob = new Object();
bob.age = 17;

// this time we have added a method, setAge

bob.setAge = function (newAge){
bob.age = newAge;

bob.getYearOfBirth = function () {
return 2014 - bob.age;


I apologize. It is setAge, not newAge..... I think......


Did you figure out the problem on your own? Or are you still stuck on the lesson?