#17. This works for everyone help


#1

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

It keeps saying "Make sure to change susan to 35", when I already did so.
this is my 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=(35);

can anyone tell me whats wrong with the code?


#2

Hello @coursepro35324,

When you have defined a method for an object like bob or susan, you don't have to use the equality operator. Instead, you can use pass the number directly in as a parameter, like so

random_function(234)

Hope this clears things up...

Regards,
Barry Allen


#3

Thank you, that helped so much!


#4

No worries @coursepro35324! Keep coding hard :smile:! And if you feel that I have resolved your query, then please leave my post as the solution to the topic so that others know that it is closed. Keep coding hard :smile:!


#5

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