JSFiddle - React, Tailwind, and code Playground
JavaScript
let NewObject = function(name){
let _somePrivateVar = 'Hello';
this.publicVar = 'Hi';
this.name = name;
this.methodOne = function(){
console.log('1', _somePrivateVar, this.publicVar, this)
}
}
NewObject.prototype.methodTwo = function(){
console.log('2', this.publicVar, this);
}
let test = new NewObject('test1');
test.methodOne();
test.methodTwo();
let test2 = new NewObject('test2');
test2.methodOne();
test2.methodTwo();
console.log('1', test2.methodOne === test.methodOne)
console.log('2', test2.methodTwo === test.methodTwo)