Why can"t get and set be used with writable in
Object.defineProperty () will report an error
var obj = {}
Object.defineProperty(obj, "name", {
configurable: true,
enumerable: true,
writable: true,
value: 2,
set(value) {
name = value
},
get() {
return value
}
})
obj.name = 2
console.log(obj.name)
if the code above, it will report Cannot both specify accessors and a value or writable attribute this error
solve