JSFiddle - React, Tailwind, and code Playground
by pitaj
JavaScript
function Person( properties ) { // 'properties' is an object literal
this._private = properties; // private by convention
for ( key in this._private ) {
eval("this[key] = function() { return this._private['"+key.toString()+"'];}");
}
}
var a = "";
window.jack = new Person({
working:true,
age:33,
gender:'male'
});
a+=jack.working()+"<br>";
a+=jack.age()+"<br>";
a+=jack.gender()+"<br>";
document.write(a);