<body> <input type="text" id="input"> <script> let obj = {}; let temp = {}; Object.defineProperty(obj,'name',{ get(){ return temp["name"] }, set(val){ temp["name"] = val; inputss.value = val; } }) input.addEventListener('input',function(){ obj.name = this.value }) </script> </body>