JSFiddle - React, Tailwind, and code Playground
JavaScript
function Person(firstname, lastname) {
this.firstName = firstname;
this.lastName = lastname;
this.fullName= function() {
return this.firstName + '' + this.lastName;
}
Object.defineProperty(this, "firstName", {
get: function () { return this.firstName; },
set: function (val) {this.firstName = val; }
});
Object.defineProperty(this, "lastName", {
get: function () { return this.lastName; },
set: function (val) { this.lastName = val; }
});
}
console.log("obj:", Person('Rajashekhar','Patimidi').fullName);