17 Error but no error?


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

Okay so this is my code and the error message TypeError: susan.setAge is not a function what could I be doing wrong?


#2

Comma instead of period on this line. :slightly_smiling:


#3

Omg I can't believe I made such a small mistake on this. -.- Thanks @cadecodes


#4

Welcome! When coding, even the smallest errors can break your program. :slightly_smiling:

P.S. Nice picture! :wink: