for (const key in person) { let oldVal = person[key]; Object.defineProperty(person, key, { configurable: true, get() { return oldVal; }, set(val) { oldVal = val; _render(ul); } }) } inp.oninput = function () { person.weight = this.value; }