일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- 나머지매개변수
- React
- javascript reduce메소드
- every method
- 교차타입
- typescipt
- javascript some
- reducemethod
- map
- js6
- Typescript
- javascript
- 타입스크립트
- ES6
- Javscript
- map메소드
- defalutparameter
- html
- CSS
- javascript style
- Clipboard.writeText()
- CSS3
- CLASS
- javascript every
- 단일스레드
- filter메소드
- method
- 전개구문
- factoryfunction
- 기본값매개변수
- Today
- Total
목록타입스크립트 (2)
개발일지
제네릭은 특정 타입을 이용해서 템플릿처럼 함수를 만들 수 있다 function getSize(arr:T[]):number{ //는 통일해야한다. return arr.length; } const arr=[1,2,3]; console.log(getSize(arr)); const arr2 =['a','b','c','d','e']; console.log(getSize(arr2)); const arr3 = [true,false,false,true]; console.log(getSize(arr3)); 제네릭(Generics) 사용 - function 함수명(매개변수:타입파라미터):타입{} 는 아무 값이나 가능 interface Mobile{ //제네릭 사용 name :string; price:number; opti..
리터럴 , 유니온 const userName1 = 'Bob';//type -> 'Bob' (상수) let userName2 = 'Tom'; //type -> string(초기값) let userName3:string | number = 'kim'; userName3 = 100; console.log(userName1,userName2,userName3); type Job = 'police'|'developer'|'teacher' interface User{ name:string; job : Job;// 튜플 type Job } const user:User ={ name:'Bob', job:'student' // job : 'student' -> 에러 Job 외의 단어 } console.log(user.n..