JSFiddle - React, Tailwind, and code Playground
JavaScript
// jeden z mnoha pokusu o implementaci privátních metod
// http://daniel.steigerwald.cz (MIT Licensed)
function Person(name) {
this.name = name;
};
Person.prototype = (function() {
var toString = function() {
return 'Person name is: ' + this.name;
};
return {
toString: function() {
return toString.call(this);
}
};
})();
// příklad
var person = new Person('Joe');
alert(person);