fullfish의 개발자 도전기

  • 홈
  • 글쓰기
  • 태그
  • 방명록

nomadcoder/Typescript로 블록체인 만들기 2

Typescript (Classes & Interfaces)

type Words = { [key: string]: string; }; class Word { constructor(public term: string, public def: string) {} } class Dict { private words: Words constructor() { this.words = {} } add(term: string) { if (this.words[term] === undefined) { this.words[term] = '' } } get(term: string) { if (this.words[term] !== undefined) { return console.log(this.words[term]) } } delete(term: string) { if (this.wor..

nomadcoder/Typescript로 블록체인 만들기 2023.02.13

Typescript (Basic & Functions)

쓰는 이유 1. Type 안정성 // js는 [1,2,3] + false === '1,2,3false' function divide(a,b){ return a/b } divide('xxx') === NaN // 인자가 2개가 들어오지도 않았고 타입도 안맞지만 에러를 안띄움 2. 런타임에러(코드실행중의 에러) 방지 const obj = {name:'manseon'} obj.hi() // obj.hi is no a function에러가 뜸 // 즉, 실행을 이미 시키고 에러를 띄움 // 애초에 obj에 hi가 없음을 먼저 인지하는 편이 좋음 문법 타입을 지정안해줘도 추론함 let a = 'a' a = 'b' // ok let a = 'a' a = 1 //type 에러 남 구체적 명시 let b : boole..

nomadcoder/Typescript로 블록체인 만들기 2023.02.06
1
더보기
프로필사진

  • 분류 전체보기 (248)
    • 코딩 테스트 (109)
      • 알고리즘 문제 푼거 모음 (1)
      • 알고리즘 공부 (22)
      • 프로그래머스 level1 (56)
      • 프로그래머스 level2 (28)
      • 기타 (1)
    • 코딩 공부 (50)
      • 코드스테이츠 TIL (22)
      • 공부 (16)
      • 보안 (6)
      • 검색 (6)
    • nomadcoder (13)
      • Vanilla JS (4)
      • React JS로 영화 웹 서비스 만들기 (1)
      • React JS 마스터클래스 (6)
      • Typescript로 블록체인 만들기 (2)
    • Project (54)
      • mini-project (3)
      • codestates-first-project (9)
      • codestates-final-project (29)
      • arduino (8)
      • unity (2)
      • fullmemo (3)
    • RN (12)
    • 기타 (8)
      • 비공개 (0)
      • 기타 (8)

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

글쓰기

티스토리툴바