JSFiddle - React, Tailwind, and code Playground
by Artem
JavaScript
'use strict';
class Pointer {
constructor(o) {
this.referred = o;
}
get name() {
return this.referred.name;
}
set name(val) {
return this.referred.name = val;
}
}
const o = { name: "Vasya" };
const p1 = new Pointer(o);
const p2 = new Pointer(o);
p1.name = "Petya";
console.log(o);