[자바스크립트 딥다이브 스터디2주차] 10장 - 19장

susu.J·2022년 5월 1일
const person = {
  // 데이터 프로퍼티
  firstName: 'Ungmo',
  lastName: 'Lee',
  // fullName은 접근자 함수로 구성된 접근자 프로퍼티다.
  // getter 함수
  get fullName() {
    return `${this.firstName} ${this.lastName}`;
  },
  // setter 함수
  set fullName(name) {
    // 배열 디스트럭처링 할당: "31.1 배열 디스트럭처링 할당" 참고
    [this.firstName, this.lastName] = name.split(' ');
  }
};

person.fullName 에서 getter함수 호출하고
person.fullName = 'jaenam jung'
person.fullName 을
다시 호출하면 'jaenam jung'으로 ...

proto
얘는 getter setter 역할로서 존재를 한다는걸 알수있다



위와같이 찍어보면
prototype은 실존하는 객체다 ~라는걸 알수있다.

profile
on the move 👉🏼 https://sjeong82.tistory.com/

0개의 댓글