The "this" Keyword


No errors; I just have a question about terminology for the following line in this exercise:
bob.setAge = setAge.
My question is, is there a term for what this line is? It's not a function. Is it just a key-value paring? Is there a more technical term to refer to this by?

The whole code is:

// here we define our method using "this", before we even introduce bob
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



setAge = function (newAge) {
  this.age = newAge;

then on this line:

bob.setAge = setAge;

we create a method (setAge), but we use an existing function to create the method, rather then creating a new method from scratch

don't think there is a technical term


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