JSFiddle - React, Tailwind, and code Playground
JavaScript
function Machine() {
/*Lexical Environment = { <----------, <--------,
self: this | |
} | |
*/// | |
this._enabled = false; // | |
var self = this; // | |
this.enable = function() { // [[Scope]] ---' |
self._enabled = true; // |
}; // |
} // |
// |
function CoffeeMachine() { // |
Machine.apply(this, arguments); // |
// |
var parentEnable = this.enable; // [[Scope]]]---------'
this.enable = function() {
parentEnable();
}
}
var coffeeMachine = new CoffeeMachine();
coffeeMachine.enable();