JSFiddle - React, Tailwind, and code Playground

by samsel

JavaScript

var Person = function(f, l) {
	this.setFName(f);
	this.setLName(l);
}



Person.prototype = {
	get fname() {
		return this.fname_;
	},

	set lname(l) {
		this.lname_ = l;
	},
    
    setFName: function(f) {
        this.fname_ = f;
    },
    
    setLName: function(l) {
        this.lname_ = l;
    }    
};
    
var person = new Person("john", "doe");
console.log(person.fname_);
console.log(person.fname);
console.log(person);