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
- node.js란
- SSE
- 실시간알림
- partitioning
- 개발자
- localStorage
- EventSource
- Node.js기본
- mariadb
- node.js
- Partition
- frontend
- 열공하자
- ServerSentEvent
- 성장기
- PostgreSQL
- Lag
- 파티셔닝
Archives
- Today
- Total
써치킴의 우당탕탕 개발 블로그
[TypeScript][ch5][Interface] function in interface 본문
interface Person4 {
name: string;
age?: number;
hello(): void;
}
// 함수 선언 방식 1. function 키워드 이용
const p41: Person4 = {
name: 'searchkim',
age: 29,
hello: function (): void {
console.log(`안녕하세요! ${this.name}입니다.`);
}
}
// 함수 선언 방식 2.
const p42: Person4 = {
name: 'searchkim',
age: 29,
hello(): void {
console.log(`안녕하세요! ${this.name}입니다.`);
}
}
// 함수 선언 방식 3. 화살표 함수
// 화살표 함수에서는 this 사용 불가능
const p43: Person4 = {
name: 'searchkim',
age: 29,
hello: (): void => {
console.log(`안녕하세요! 입니다.`);
}
}
p41.hello();
p42.hello();
'TypeScript 합시다' 카테고리의 다른 글
[TypeScript][ch5][Interface] interface extends interface (0) | 2022.02.14 |
---|---|
[TypeScript][ch5][Interface] class implements interface (0) | 2022.02.14 |
[TypeScript][ch5][Interface] optional property (0) | 2022.02.14 |
[TypeScript][ch5][Interface] What are Interface (0) | 2022.02.14 |
[TypeScript][ch4][TypeScript Compiler] compileOptions - strict (0) | 2022.02.14 |
Comments