일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Class
- Number
- methods
- null
- javascript
- 비교연산자
- mouseout
- 타입스크립트
- undefined
- elseif
- 제어문
- click
- slider
- 논리연산자
- EVENT
- jQuery
- if
- function
- Chaining
- Object
- boolean
- html
- 증감연산자
- TAB
- array
- typescript
- Narrowing
- 산술연산자
- literaltype
- type
- Today
- Total
목록methods (2)
angsu
class 만들 때 타입지정 가능 🍎 필드값 타입지정 class Person { data:number = 0; // 타입 지정 } let john = new Person(); let kim = new Person(); console.log(john.data); console.log(kim.data); 🍎 constructor 타입지정 class Person { constructor (){ this.name = 'kim'; this.age = 20; } } // Error : Property 'name' does not exist on type 'Person' 해결책. class Person { name; age; // 필드값 지정해야 오류가 안남 constructor (){ this.name = 'kim..
함수와 methods에 type alias 지정하는 법 🍎 function type 도 저장가능 함수에 들어갈 파라미터와 return으로 뱉을 값들을 타입지정할 수 있다고 배워봤습니다. 함수 타입도 type alias로 저장해서 쓸 수 있습니다. let 함수명 : 타입별명 = function(){} type NumOut = (x : number, y : number ) => number let ABC :NumOut = function(x,y){ return x + y } 🍎 methods 안에 타입지정하기 object 자료 안에 함수도 맘대로 집어넣을 수 있습니다. let 회원정보 = { name : 'kim', age : 30, plusOne (x){ return x + 1 }, changeName :..