본문 바로가기

rhanziy

검색하기
rhanziy
프로필사진 rhanziy

  • 분류 전체보기 (170)
    • git (3)
    • Html_css_js (55)
    • React (25)
    • React Native (20)
    • Next.js (13)
    • Node.js (12)
    • Java (22)
    • Development setting (7)
    • study (9)
    • doodle (4)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
일 월 화 수 목 금 토
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
  • 스크롤이벤트
  • Next.js
  • map
  • interface
  • extends
  • 글또10기x코드트리
  • xlsx-js-style
  • array
  • generic
  • 상속
  • 슬라이딩윈도우
  • supabase auth
  • javascript
  • 페이지네이션
  • Spring
  • 코드푸시
  • app.post
  • set
  • meatadata
  • Filter
  • supabase authentication
  • async
  • code-push-standalone
  • reactnative
  • 타입스크립트
  • TS
  • react
  • 이진탐색
  • supabase 페이지네이션
  • codepush
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록class field (1)

rhanziy

TS - class의 타입지정

object 뽑는 기계 class에도 타입을 지정해줄 수 있다. ES6 신문법에서는 constructor함수를 쓰면 되는데, this.어쩌구를 쓰고 싶으면 미리 어쩌구를 필드값으로 지정해 줘야함. class CarInfo { model : string; price : number; constructor(a:string, b:number){ this.model = a, this.price = b } tax() :number{ return this.price * 0.1; } } let car = new CarInfo('소나타', 3000); console.log(car); // { model : '소나타', price : 3000 } console.log(car.tax()); // 300 필드값으로 mode..

Html_css_js 2023. 1. 27. 17:05
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바