var person = {
name: 'Ivan'
}
Object.defineProperty(person, 'name' , {
get: function(){
console.log(this.name);
return this.name
//так же ставлю set
}
})
var person = {
_name: 'Ivan'
}
Object.defineProperty(person, 'name' , {
get: function(){
console.log(this._name);
return this._name
}
})
var person = {
_name: 'Ivan'
}
Object.defineProperty(person, 'name' , {
get: function(){
console.log(this._name);
return this._name
//так же ставлю set
}
})