About bob.setAge = setAge, thankS


According to the code below,
I am still confused of this "bob,setAge = setAge;",
How does it actually mean and work on it?
Thank you so much

Replace this line with your code. 

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();


Functions are values like any other if that's what the confusion is about

function f() {
    console.log('called f');

g = f;
g();  // called f


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