Recently Note BEM ( Block Element Modifier ) BEM이란? HTML 클래스 속성의 작명법 요소__일부분 : Underscore(LoDash)기호로 요소의 일부분을 표시 요소--상태 : Hyphen(Dash) 기호로 요소의 상태를 표시 BEM이 필요한 이유 요소__일부분 아래 코드를 먼저 보자. container내부에 name이라는 class가 있고, item내에도 name이라는 클래스가 있다. 후손 선택자를 사용해서 구분할 수도 있지만, 복잡해지기 때문에 명확하게 하기 위해서 BEM을 사용해서 바꿔 줄 수 있다. 아래 그림처럼 사용한다면 css만 봐도 어떤 부분의 요소를 선택해서 작성하였는지 알 수있다. 요소--상태 버튼의 경우 버튼을 클릭하기 전 후 그외의 상태들이 존재 할 수 있다. 또 버튼들이 동시에 가져야 할 속성들도 있을 수 있다. 아래코드.. 2022.10.11 Generics Generics이란? any는 어떤 타입이 들어오는지 상관없이 때문에 타입마다 잘못된 내부 함수를 사용하거나 타입 추론할 때 유용하지 못하다. 하지만 Generic의 경우에는 컴파일 타임에 타입을 추론하여 return과 parameter의 타입을 추론할 수 있도록 도와준다. function hello(message: any): any { return message; } console.log(hello("Mark").length); console.log(hello(39).length); // undefined가 된다. function helloGeneric(message: T): T { return message; } console.log(helloGeneric('Mark').length); console.. 2022.10.10 Class static / 싱글톤 / 상속 / Abstract static 사용하기 static키워드는 메모리에 멤버를 항상 상주하게 해주는 키워드이다. 그래서 클래스로 초기화하지 않아도 바로 사용할 수 있으며 모든 객체들이 같은 멤버(함수) 를 참조하게 된다. class Person { private static CITY = "Seoul"; public static hello() { console.log("안녕하세요", Person.CITY); } } const p1 = new Person(); Person.hello(); Singleton Pattern구현하기 싱글톤패턴은 같은 객체를 사용하기 위해 필요한 객체이다. 자세한 부분 - class ClassName { private static _INSTANCE: ClassName | null = null; priv.. 2022.10.09 A.I Time2Vec Stock Market Prediction on High-Frequency Data Using Generative Adversarial Nets Predicting and Recommending Food Ingredient Pairings Siamese Neural Networks for One-shot Image Recognition Attention Is All you Need - Transformer 시계열 데이터란 무엇인가? Artistic Style Transfer이해하기 Algorithm Monge array란? 1965번 상자넣기 공유기 설치 - 2110번 최소값 찾기 - 11003번 탑 - 2493번 FrontEnd BEM ( Block Element Modifier ) BEM이란? HTML 클래스 속성의 작명법 요소__일부분 : Underscore(LoDash)기호로 요소의 일부분을 표시 요소--상태 : Hyphen(Dash) 기호로 요소의 상태를 표시 BEM이 필요한 이유 요소__일부분 아래 코드를 먼저 보자. container내부에 name이라는 class가 있고, item내에도 name이라는 클래스가 있다. 후손 선택자를 사용해서 구분할 수도 있지만, 복잡해지기 때문에 명확하게 하기 위해서 BEM을 사용해서 바꿔 줄 수 있다. 아래 그림처럼 사용한다면 css만 봐도 어떤 부분의 요소를 선택해서 작성하였는지 알 수있다. 요소--상태 버튼의 경우 버튼을 클릭하기 전 후 그외의 상태들이 존재 할 수 있다. 또 버튼들이 동시에 가져야 할 속성들도 있을 수 있다. 아래코드.. 댓글 0 2022.10.11 Generics Generics이란? any는 어떤 타입이 들어오는지 상관없이 때문에 타입마다 잘못된 내부 함수를 사용하거나 타입 추론할 때 유용하지 못하다. 하지만 Generic의 경우에는 컴파일 타임에 타입을 추론하여 return과 parameter의 타입을 추론할 수 있도록 도와준다. function hello(message: any): any { return message; } console.log(hello("Mark").length); console.log(hello(39).length); // undefined가 된다. function helloGeneric(message: T): T { return message; } console.log(helloGeneric('Mark').length); console.. 댓글 0 2022.10.10 Class static / 싱글톤 / 상속 / Abstract static 사용하기 static키워드는 메모리에 멤버를 항상 상주하게 해주는 키워드이다. 그래서 클래스로 초기화하지 않아도 바로 사용할 수 있으며 모든 객체들이 같은 멤버(함수) 를 참조하게 된다. class Person { private static CITY = "Seoul"; public static hello() { console.log("안녕하세요", Person.CITY); } } const p1 = new Person(); Person.hello(); Singleton Pattern구현하기 싱글톤패턴은 같은 객체를 사용하기 위해 필요한 객체이다. 자세한 부분 - class ClassName { private static _INSTANCE: ClassName | null = null; priv.. 댓글 0 2022.10.09 Class 정의 / 초기화 / Getter And Setter Class란 object를 만드는 blueprint이다. class내부에는 함수, 멤버 등 여러가지를 정의할 수 있다. 클래스를 정의하는 방법 class키워드를 이용하여 클래스를 만들 수 있다. class 이름은 보통 대문자를 이용한다. new를 이용하여 class를 통해 object를 만들 수 있다. contsructor를 이용하여 object를 생성하면서 값을 전달 할 수 있다. this를 이용해서 만들어진 object를 가르킬 수 있다. JS로 컴파일되면 es5의 경우 function으로 변경된다. class Person { name: string; constructor(name: string) { this.name = name; } } 클래스 초기화 멤버는 무조건적으로 변수가 들어가야만 한다. 직.. 댓글 0 2022.10.08 Interface Interface란? 데이터의 골격을 정해준다. interface Person1 { name : string; age: number; }; function hello1(person: Person1): void { console.log(`안녕하세요. ${person.name} 입니다.`); }; const p1: Person1 = { name: 'Mark', age: 39, }; hello1(p1); 하지만 js로 컴파일 했을 때 나타나지는 않는다. typescript를 사용할 때에만 사용하는 문법이다. "use strict"; function hello1(person) { console.log(`안녕하세요. ${person.name} 입니다.`); }; const p1 = { name: 'Mark', a.. 댓글 0 2022.10.07 BackEnd Authentication 메커니즘 more 기본 실습 more Entity의 기본속성 more JPA Repository more