분류 전체보기 124

complete, done, finish (end, close, conclude)

https://raccoonenglish.tistory.com/entry/completed-done-finished-%EC%B0%A8%EC%9D%B4%EC%A0%90-%EC%A0%95%EB%A6%AC completed, done, finished 차이점 정리 completed, done, finished 차이점 정리 라쿤잉글리시 미친너굴입니다. 오늘은 completed, done, finished의 차이점에 대해서 살펴보겠습니다. 동의어라고 알고 있지만, 어떤 점이 차이가 나는지 설명드리고 raccoonenglish.tistory.com https://phrase-phrase.me/ko/keyword/end-finish-complete-conclude-close end, finish, complete, ..

A-HA!/영어사전 2024.01.09

[TS] simple blockchain

index.ts // Module '"crypto"' has no default export. import crypto from "crypto" // import * as crypto from "crypto" interface BlockShape { hash: string prevHash: string height: number data: string } class Block implements BlockShape { public hash: string constructor( // no readonly => 접근 및 수정 가능 public readonly prevHash: string, public readonly height: number, public readonly data: string ) { t..

[TS] tsconfig.json

1. typescript 설치 npm i -D typescript 2. package.json 초기화 npm init -y "scripts": { "build": "tsc" // "npx tsc" } 3. tsconfig.json 설정 에디터는 우리가 TS로 작업한다는 것을 알게 되고, 자동완성기능을 제공한다. 디렉터리에 tsconfig.json 파일이 있으면 해당 디렉터리가 TypeScript 프로젝트의 루트임을 나타냅니다. tsconfig.json 파일은 프로젝트를 컴파일하는 데 필요한 루트 파일과 컴파일러 옵션을 지정합니다. include : It tells TS where to look for code to compile ourDir : It tells TS where to put the outp..

[TS] Polymorphism + Generic Type + Interface

// Storage는 이미 JS내 존재하여 재선언이 됨 interface SStorage { [key:string]: T } class LocalStorage { // 초기화할 것이 없기 때문에 constructor 사용하지 않음 private storage: SStorage = {} set(key: string, value: T) { if (this.storage[key] === undefined) { this.storage[key] = value } } get(key: string): T { if (this.storage[key] !== undefined) { return this.storage[key] } } remove(key: string) { if (this.storage[key] === un..

[TS] Interfaces

interface의 두가지 용도 type vs. class 🏁 object type specific value of concrete type 오직 객체의 모양을 특정해주기 위함 type과 interface는 오브젝트의 모양을 결정한다는 공통점이 있지만, type은 다른 형태도 설명할 수 있는 반면 interface는 오직 객체만 가능하다. 그래서 type의 쓰임이 더 많다. 결론 object → interface 그 외 (type alias, 특정값 등) → type 이 방법이 더 객체지향 프로그래밍처럼 보여서 이해하기 쉽다 // interface로는 object 외 선언 불가 type Team = "red" | "blue" | "yellow" type Health = 1 | 5 | 10 type Pla..

[TS] Classes

객체지향 프로그래밍 - JS에는 없는 개념 1. 생성자 자동 생성 생성자의 파라미터를 써주기만 하면 consturctor() 함수 자동 생성 // TypeScript class Player { constructor ( private firstName: string, private lastName: string ) {} } // JavaScript class Player { cosntructor (firstName, lastName) { this.firstName = firstName } } 2. 추상 클래스 (abstract class) 오직 다른 클래스에서 상속받을 수만 있는 클래스 직접 인스턴스 생성(인스턴스화) 불가 추상 메소드 추상 클래스 안에서 구현(implemetation)하지 않고 call ..

[JS] Events

element 객체 내부의 property들 중 이름이 on- 으로 시작하면 모두 eventJS는 모든 event listen 가능 event :어떤 행위를 하는 것. do something eventListener :JS에게 무슨 event를 listen하고싶은지 알려주어 listen함 title.addEventListener("click") :누군가 title을 click하는 것을 listen할 것임 → click하면 취할 액션 정의 const h1 = document.querySelector("div.hello:first-child h1")function handleTitleClick() { h1.style.color = "blue"}function handleMous..

Front-end/Vanila JS 2023.12.27

[JS] console 객체 (log, dir, ..)

console.log() : 객체를 출력 *주의: 해당 순간의 값이 아닌 최종 업데이트값 출력 → 과정의 순간을 출력하고 싶다면 JSON.stringfy() 이용해서 출력할 것 console.dir() : 객체의 속성을 계층구조로 출력 ref. console.log() [JavaScript] Console 객체 (1) Console 자바스크립트에는 console이라는 객체가 존재한다. Console은 디버깅을 위해 존재하는 객체로, console의 함수를 이용하면 크롬 개발자도구의 콘솔창에 여러 정보를 출력할 수 있다. Console 객체 jongbeom-dev.tistory.com console.dir() [JavaScript] Console 객체 (2) console.dir() log 함수 다음으로 ..

A-HA💡/JS 2023.12.27