17 'This' Works for Everyone Error


#1



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


Error message: Oops try again! Make sure to change susan's age to 35!


Replace this line with your code. 
// 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;
susan.setAge = setAge;
// here, update Susan's age to 35 using the method
susan.setAge = setAge(35);


#2

Hi try to change this line

susan.setAge = setAge(35);

with that

susan.setAge(35);

#3

Omg! Thank you, that had me stumped for a day.


#4

You did exactly what I did and mine doesn't work. I'm stumped on it.


#5

Here's the code I'm using. It's not working.
// 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;
susan.setAge = setAge;

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

Can someone help me out? That would be great. ;]


#6

Never mind I got it ;}


#7

A post was split to a new topic: How u did it?