class Student {
constructor(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
get fullName() {
return `${this.lastName} ${this.firstName}`;
}
set fullName(value){
console.log(value);
}
}
const student = new Student('수지', '김');
console.log(student.fullName);
student.fullName = '김철수';
'코딩 > 자바스크립트 JS 드림코딩' 카테고리의 다른 글
JS Boolean / falshy, truthy (0) | 2022.12.01 |
---|---|
JS 상속 , 테스트 문제 (0) | 2022.11.30 |
자바스크립트 JS 클래스 (0) | 2022.11.30 |
자바스크립트 함수 , 불변성 (0) | 2022.11.30 |
자바스크립트 JS 반복문 (0) | 2022.11.30 |