javascript93 Tree / Binary Search Tree 1. Tree In computer science, a tree is a widely used abstract data type(추상적인 데이터 유형) that simulates a hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes. A tree data structure can be defined recursively as a collection of nodes, where each node is a data structure consisting of a value and a list of references to nodes.. 2022. 2. 26. this dotnotation function talk () { return `I am ${this.name}` } const me = { name : `rami`, age : 32, talk } const you = { name : `hey`, age : 1, talk } me.talk(); //I am rami you.talk(); //I am hey https://www.youtube.com/watch?v=fVXp7ZWjlO4 2022. 2. 16. prototype/__proto__ javascript : prototype based language 메모리 절감을 위해 사용 객체가 공통적으로 사용하는 속성을 만드는것. person이라고 하는 생성자함수에 공통적으로 사용할 sum이라는 method를 만듦. Person.prototye.sum = function Person(name, first, second, third){ this.name=name; this.first=first; this.second=second; } Person.prototype.sum = function(){ return 'prototype : '+(this.first+this.second); } var kim = new Person('kim', 10, 20); kim.sum = function(){ retur.. 2022. 2. 5. closure Closure : 어떤 함수 A에서 선언한 변수 a를 참조하는 내부함수 B를 외부로 전달할 경우 A의 실행 컨텍스트가 종료된 이후에도 변수 a가 사라지지 않는 현상. var outer = function () { var a = 1; var inner = function () { return ++a; }; return inner; } var outer2 = outer(); console.log(outer2()); //2 console.log(outer2()); //3 (function () { var a = 0; var intervalId = null; var inner = function () { if (++a >= 10) { clearInterval(intervalId); } console.log(a).. 2022. 2. 2. 이전 1 2 3 4 5 6 7 8 ··· 24 다음