16. The "this" Keyword


A method to Madness
Lesson/No. 16

The output of my code return 'undefined' but the system take the answer as correct. I don't know if this is correct or what.

This is my code on Lesson 16
// 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

Replace this line with your code.


after reading from forums i found the answer.



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