JavaScript JavaScript object accessing itself from within its property by its own name javascript object accessing,javascript object accessing properties,javascript object accessing

Please look at below codes:

Case 1:

var a = {
    b: function(){
        console.log(a)
    },
    c:1
};

Case 2:

var a = {
    b:a,
    c:1
};

Now when I write this :

a.b() // for first
console.log(a.b) // for 2nd

I get result:

{c:1}

I have two questions:

  1. How does the property 'b' of its parent 'a' can access its parent 'a' by its name, i.e. 'a'?

  2. If it's accessing it, then why doesn't it show all the properties of 'a'?

Answer:1

I get this error from the TrackballControls.js: this.domElement.addEventListener is not a function This occurs when I assign the TrackballControls to a DOM: // 'container' is a variable var ...

I get this error from the TrackballControls.js: this.domElement.addEventListener is not a function This occurs when I assign the TrackballControls to a DOM: // 'container' is a variable var ...

I'd like to augment all Objects in my Node.js application with a logging function, such that each object can call this.log or have its log function referenced by thatObject.log. I see a number of ...

I'd like to augment all Objects in my Node.js application with a logging function, such that each object can call this.log or have its log function referenced by thatObject.log. I see a number of ...

When I am trying to add the usersData object to the filter idToName inside the for loop, it suddenly becomes undefined. Shouldn't the usersData get the value before the for loop runs? How should I fix ...

When I am trying to add the usersData object to the filter idToName inside the for loop, it suddenly becomes undefined. Shouldn't the usersData get the value before the for loop runs? How should I fix ...

  1. javascript object becomes undefined
  2. javascript event object becomes visible
  3. javascript object variable becomes undefined
  4. javascript array becomes object
  5. javascript string becomes object
  6. javascript variable becomes object

I looking up to make a custom easing function to jQuery animate, and I Found a great example to how extend the easing in jQuery. Check it out: Looking for jQuery easing functions without using a ...

I looking up to make a custom easing function to jQuery animate, and I Found a great example to how extend the easing in jQuery. Check it out: Looking for jQuery easing functions without using a ...

  1. jquery custom easing
  2. jquery custom easing function