✏️9.2 필드 이름 바꾸기 (Rename Field)
Last updated
Last updated
// 상수
const organization = {name: '애크미 구스베리', country: 'GB'};class Organization {
constructor(data) {
this._name = data.name;
this._country = data.country;
}
get name() {return this._name;}
set name(aString) {this._name = aString;}
get country() {return this._country;}
set country(aCountryCode) {this.country = aCountryCode;}
}
const organization = new Organization({name: '애크미 구스베리', country: 'GB'};)class Organization {
constructor(data) {
this._title = (data.title !== undefined) ? data.title : data.name;
this._country = data.country;
}
get name() {return this._title;}
set name(aString) {this._title = aString;}
get country() {return this._country;}
set country(aCountryCode) {this.country = aCountryCode;}
}class Organization {
constructor(data) {
this._title = data.title;
this._country = data.country;
}
get title() {return this._title;}
set title(aString) {this._title = aString;}
get country() {return this._country;}
set country(aCountryCode) {this.country = aCountryCode;}
}