JSFiddle - React, Tailwind, and code Playground

JavaScript

function MyClass(config) {
    this.dir = config.dir;
    this.type = config.type;
}

MyClass.prototype.foo = function (){
    console.log(this);
}

MyClass.prototype.bar = function () {
    console.log(this.dir);
}

var myObject = new MyClass({
    dir: "myDir",
    type:"myType"
});

myObject.foo();
myObject.bar();