typescript static methods & properties

SUNG JUN LEE·2023년 2월 27일
0

아래와 같은 클래스가 있다고 가정하자.

class Department {
  static year = 200;
  
  constructor(...){
  
    ...
    
  }
  ...
}

생성자(constructor) 에서 year 에 접근하고 싶다면, 아래와 같은 방식으로 접근할 수 있다.

  1. className.year => Department.year
  2. this.constructor.year
profile
FE developer

0개의 댓글