JSFiddle - React, Tailwind, and code Playground
JavaScript
// construct
function Human(name){
this.name = name;
}
// setter
Human.prototype.setName = function(name){
this.name = name;
};
// getter
Human.prototype.getName = function(){
return this.name;
};
/* --------------------------- */
var human = new Human("John");
human.setName("Eddie");
alert(human.getName());