The "this" Keyword


#1



https://www.codecademy.com/courses/spencer-sandbox/2/4?curriculum_id=506324b3a7dffd00020bf661#


TypeError: bob.setAge is not a function


// 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
console.log(bob.setAge(50));
  

bob.setAge(45);

what is the mistake in this?

looking for help!!!


#2

Hi you should not remove this part

// and down here we just use the method we already made
bob.setAge = setAge;

#3

I got it
Thank you for super fast response.