JSFiddle - React, Tailwind, and code Playground

JavaScript

function Scope(){};
var scope = new Scope();

function ChildScope(){};
ChildScope.prototype = scope;
var childScope = new ChildScope();

scope.a = 1;
scope.obj = {a: 1};

console.log(scope.a); // should be 1
console.log(childScope.a); // should be 1
console.log(scope.obj.a); // should be 1
console.log(childScope.obj.a); // should be 1

childScope.a = 2;
childScope.obj.a = 3;

console.log(scope.a); // should be 1
console.log(childScope.a); // should be 2
console.log(scope.obj.a); // should be 3
console.log(childScope.obj.a); // should be 3