JSFiddle - React, Tailwind, and code Playground

JavaScript

function Scope() {
    }
    
    Scope.prototype.$new = function() {
        var new_scope = new Scope();
        
        //TODO: change line bellow 
        new_scope.__proto__ = this;
        
        return new_scope;
    }
    
    // Create root scope
    var scope_level_1 = new Scope();
    scope_level_1.a = 'scope_level_1 a';
    scope_level_1.b = 'scope_level_1 b';
    
    // Create scope which inherits from parent
    var scope_level_2 = scope_level_1.$new();
    scope_level_2.b = 'scope_level_2 b';
    
    // We don't have property "a" in "scope_level_2" so it will be taken from "scope_level_1"
    // But we have property "b" in "scope_level_2" so it will be taken from there
    console.log(scope_level_2.a, scope_level_2.b);