JSFiddle - React, Tailwind, and code Playground

JavaScript

TestObject = function(){};

TestObject.prototype.AnotherObject = function() {};

var myObject = new TestObject();

TestObject.prototype.createAnObject = function() {
    this.AnotherObject = new TestObject.prototype.AnotherObject();
}
myObject.createAnObject();

alert(myObject.AnotherObject);