본문 바로가기

분류 전체보기79

[BST] Construct binary search tree methods :: insert, contains, remove(delete) BST definition BST class BST { constructor(value) { this.value = value; this.left = null; this.right = null; } insert(value) { let currentNode = this; while (currentNode !== null) { if (currentNode.value > value) { if (currentNode.left === null) { currentNode.left = new BST(value); } else { currentNode.left.insert(value); } } else { if (currentNode.right === null) { currentNode.right = new BST(v.. 2022. 7. 4.
CSS selector with data attribute [css] selector [attributes=”—”], data attributes with data attribute div[data-your-name="tio"] { } with javascript dom manipulation const dom = document.querySelector('div.test[data-id="100"]'); General usage [class="(╯°□°)╯︵ ┻━┻"]{ color: red; font-weight: bold; } [data-value] { /* Attribute exists */ } [data-value="foo"] { /* Attribute has this exact value */ } [data-value*="foo"] { /*.. 2022. 7. 4.
시작: 어차피 한 번은 끝장을 봐야 한다 목표 알고리즘 문제를 보고 필요한 자료 구조, 알고리즘, 문제 해결 전략을 떠올리고 코딩할 수 있다. 목적 글로벌 IT 기업 코딩 테스트, 인터뷰 알고리즘을 흥미를 가지고 이어갈 수 있는 기초 함양 생각을 코드로 표현할 수 있는 능력 향상 종만북, 프로그래밍 대회에서 배우는 알고리즘 문제 해결 전략 백준 Ranker에게 과외 Corsera Algorithm part 1, Princeton University AlgoExpert 160 Coding Interview Questions 2022. 7. 2.
@page: how to change size of page when printing, A4, portrait, landscape The @page CSS at-rule is used to modify some CSS properties when printing a document. @Page @page { } /* example */ @page { margin: 1cm; } @page :first { margin: 2cm; } size Specifies the target size and orientation of the page box's containing block. In the general case, where one page box is rendered onto one page sheet, it also indicates the size of the destination page sheet. /* Keyword valu.. 2022. 7. 2.
@media only print: apply css only on print mode pinrt css inside @media only print only applied when printing @media only print { .body { background: black !important; } 2022. 7. 2.
requestFullscreen(): How to make dom Fullscreen [Document.fullscreenElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenElement) / [ShadowRoot.fullscreenElement](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/fullscreenElement) The fullscreenElement property tells you the [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) that's currently being displayed in fullscreen mode on the DOM (or .. 2022. 7. 2.
Keyboard Event: How to detect keyboard you typed: e.which, e.keycode, e.key, e.charcode, e.code which, keycode, key, charcode, code when I type 'f', charCode: 0 keyCode: 70 key='f' code='KeyF' which: 102 charCode, keyCode: deprecated charCode: Non-standard Reference 2022. 6. 29.
Event vs CustomEvent && How to trigger event with data Event vs CustomEvent CustomEvent can send data through 'detail' property, but Event can not do that; Event const eventInstance = new Event(':eventName'); // add event on document document.addEventListener(':eventName', (e) => { // TODO console.log(e); }); // trigger event document.dispatch(eventInstance);CustomEvent const customEventInstance = new CustomEvent(':custom.. 2022. 6. 27.
Constructor overloading with default 변수 선언 후 생성자에서 할당 class Test { name: string; protected age: number; public id?: string; private password?: string; constructor(name = "", age = 0, id = undefined, password = undefined) { this.name = name; this.age = age; this.id = id; this.password = password; } }생성자에서 선언하고 변수 할당하기 => id, password class Test { name: string; protected age: number; constructor( name: string = "", age: number = 0, p.. 2022. 6. 25.