JSFiddle - React, Tailwind, and code Playground

JavaScript

var SomeObject = function() {
    //private var one, can't access it outside of this scope
    var one = 1;
    var referencedObject = {
        a : 'somevalue'
    };

    //public prop two, can access it outside of this scope.
    this.two = 2;

    //public method getOne, you can access it.
    this.getOne = function() {
       return one;
    };
    
    this.getReferencedObject = function() {
       return referencedObject;
    };
};

var someObject = new SomeObject();
console.log(someObject.two); // print in console 2
console.log(someObject.getOne()); // print in console 1

var referencedObject = someObject.getReferencedObject();
console.log(referencedObject);
referencedObject.a = 'anotherValue';

console.log(someObject.getReferencedObject());