Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- PostgreSQL
- 열공하자
- 파티셔닝
- mariadb
- Lag
- ServerSentEvent
- node.js란
- partitioning
- EventSource
- 실시간알림
- SSE
- Node.js기본
- Partition
- 성장기
- 개발자
- localStorage
- node.js
- frontend
Archives
- Today
- Total
써치킴의 우당탕탕 개발 블로그
[TypeScript][ch6][Class] Quick Start - class 본문
class 기본
- class 키워드를 이용해서 클래스를 만들 수 있다.
- class 이름은 보통 대문자를 사용한다.
- new를 이용햐여 class를 통해 object를 만들 수 있다.
- constructor를 이용하여 object를 생성하면서 값을 전달할 수 있다.
- this를 이용해서 만들어진 object를 가리킬 수 있다.
- JavaScript로 컴파일되면 ES5의 경우 function으로 변경된다.
class Person { // Class 이름은 보통 대문자로 시작
name;
constructor(name: string){ // 생성자
this.name = name; // this : 생성된 object 자신
}
}
const p1 = new Person("Searchkim"); // new Person의 결과는 object -> p1에 할당
console.log(p1);
'TypeScript 합시다' 카테고리의 다른 글
[TypeScript][ch6][Class] 접근 제어자(Access Modifiers) (0) | 2022.02.15 |
---|---|
[TypeScript][ch6][Class] constructor(생성자) & initialize(초기화) (0) | 2022.02.15 |
[TypeScript][ch6][Class] What are Class (0) | 2022.02.15 |
[TypeScript][ch5][Interface] type alias vs interface (0) | 2022.02.14 |
[TypeScript][ch5][Interface] Readonly Interface Properties (0) | 2022.02.14 |
Comments