16/33 I don't understand this line: bob.setAge = setAge;


Here is the code. Can someone please explain it to me in the most simplified way possible?

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

// change bob's age to 50 here


Just finished answering this for another member. Please see the following topic:



Thanks but I was even more confused by what you wrote! Can someone please explain it to me like I'm 5?


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