var book = { _year: 2018, edition: 1 }; Object.defineProperty(book, "year", { get: function() { return this._year; }, set: function(newValue) { if (newValue > 2018) { this._year = newValue; this.edition += newValue - 2018; } } }); book.year = 2020; document.write(book.year + "<br>"); // 2020 document.write(book.edition + "<br>"); // 3 //프로퍼티 속성 읽기 var _year = Object.getOwnPropertyDescriptor(book, "_year"); document.write(_year.value + "<br>"); // 2020 document.write(_year.configurable + "<br>"); // true document.write(_year.get + "<br>"); // undefined var year = Object.getOwnPropertyDescriptor(book, "year"); document.write(year.value + "<br>"); // undefined document.write(year.configurable + "<br>"); // false document.write(year.get + "<br>"); // function () { return this._year; }