JSFiddle - React, Tailwind, and code Playground
by roeburg
JavaScript
var z = {
a: function (){
console.log(this);
// declared without a var so attached to global scope
// z.c does not change!
c = 1;
},
b: function () {
// this referrs to the parent which is z
// z.c changes from 0 to 2
console.log(this);
this.c = 2;
// Create locat variable a
var a = function () {
console.log(this);
debugger;
this.c = 3;
};
a();
// this referrs to the parent which is z
this.a();
},
c: 0
};
z.b();