Whats wrong here!


#1

// 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;
bob.setAge = setAge;

// make susan here, and first give her an age of 25

var susan = new Object();
susan.age = 25;

// here, update Susan's age to 35 using the method
susan.setAge(35);


#2

You are yet to set susan's age here.

So, just as with with Bob, we do

susan.setAge = setAge;


// here, update Susan's age to 35 using the method
susan.setAge(35);

#3

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