JSFiddle - React, Tailwind, and code Playground
by Alexander
JavaScript
console.clear();
window.$private$ = function (name) {
return "\u200B[private " + name + "]"
}
var ClassA = (function () {
var $private = {
foo: $private$('foo'),
bar: $private$('bar')
};
function ClassA() {
this[$private.foo] = 1;
}
ClassA.prototype[$private.bar] = function() {
this[$private.foo] += 10;
};
ClassA.prototype.baz = function() {
this[$private.bar]();
console.log(this[$private.foo]);
};
return ClassA;
})()
var Obj1 = new ClassA();
Obj1.baz();