JSFiddle - React, Tailwind, and code Playground

JavaScript

function Child() {
    this.method = function() {
         console.dir(this);
    };
}

function Parent() {
    this.child = new Child();
}
var p = new Parent();
p.child.method();
p.child.method.call(p);