JSFiddle - React, Tailwind, and code Playground
JavaScript
function test() {
if (!(this instanceof test)) {
return new test();
}
var a = 100;
this.get = function get() {
return a;
}
this.set = function set(v) {
a = v;
}
}
q = test();
console.log(q.get());
q.set(10);
console.log(q.get());