data3 [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. 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. 이전 1 다음