I don't understand why it isn't working.

Oops, try again. It looks like you have an error in your code. Here's the message: ReferenceError: newAge is not defined

// here we define our method using "this", before we even introduce bob
var setAge = function (newAge) {
  this.age = newAge;
// now we make bob
var bob = new Object();
bob.age = 30;
// and down here we just use the method we already made
bob.setAge = newAge;
// change bob's age to 50 here


why do you have this line:

bob.setAge = newAge;

it overwrites your setAge method with a undefined variable, why would you do that?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.