본문 바로가기

2. 우당탕탕 개발자/2-1. 공부기록92

15Jan2010 TIL Browser A web browser (commonly referred to as a browser) is a software application for accessing information on the World Wide Web. When a user requests a particular website, the web browser retrieves the necessary content from a web server and then displays the resulting web page on the user's device. (출처 : Wikipedia) 이 위키피디아의 두 문장이 브라우저의 정의와 핵심 기능을 소개한 문장이라고 생각한다. 웹 브라우저는 소프트웨어 웹 어플리케이션으로서WWW.. 2020. 1. 16.
14Jan2020 TIL 오늘 한 일 : toy problem 12 _ powerSet() 글자열 글자 중복 제거 PowerSet()을 Javascript 로 구현하기 Powerset는 매개변수로 주어지는 string 또는 array의 요소를 조합하여, 모든 가능한 경우의 수 만큼의 글자 조합을 도출하는 역할을 한다. 나는 과제로 string 을 매개변수로 제공받았기 때문에, string 을 기본으로 하여 해당 함수를 구현했다. 언제나 그렇듯 나는 어렵고 복잡하게 해당 함수를 구현했는데, 사람들은 간단하게 해당 함수를 구현해낸다. 문제를 한 번 풀어보고 나선, 더 나은 알고리즘이 없을까? 하며, 다른 사람들의 코드를 보곤 하는데, 엄청난 고수의 느낌이 나는 간단하고 이해하기 쉬운 코드를 발견했다. 이머시브 코스가 끝날 즈음에 이.. 2020. 1. 14.
13Jan2020 TIL 상위 개체의 메소드를 불러오는 방법 : 상위개체.prototype.method.call(this, arguments) FlyingHorse.prototype.goSomewhere = function(destination, milesToDestination) { if (milesToDestination < 10) { return Horse.prototype.goSomewhere.call(this, destination); } else { return this.name + " is flying to " + destination + "!"; } }; 굳이 따로 지정해줄 필요는 없었다. 아래의 예제 처럼 (내가 쓴것^^!) var FlyingHorse = function(name, color) { Horse.c.. 2020. 1. 13.
11Jan2020 TIL prototype 과 상속 (pseudo-classical style) var Horse = function(name) { this.name = name; }; Horse.prototype.goSomewhere = function(destination) { return this.name + " is galloping to " + destination + "!"; }; var FlyingHorse = function(name, color) { Horse.call(this, name); this.color = color; this.oldGoSomewhere = Horse.prototype.goSomewhere.bind(this); }; FlyingHorse.prototype = Object.create(Ho.. 2020. 1. 12.
10Jan2020 TIL 라이브러리란? 사용이 잦은 로직을 재활용하기 위해 class 혹은 function 으로 정의한 것을 의미. 다른 사람들이 만든 라이브러리를 사용할 수 있고, 직접 만들 수도 있다. Underbar Review _.map(collection, iterator) _.map = function(collection, iterator) { let arr =[]; for(let el of collection) { arr.push(iterator(el)); } return arr; } _.reduce(collection, iterator, accumulator) _.reduce = function(collection, iterator, accumulator) { if (Array.isArray(collection)).. 2020. 1. 11.
09Jan2020 TIL Functional Bind Checkpoint windowTimers.setTimeout() 의 this 특징 setTimeout()에 의해 실행된 코드는 별도의 실행 컨텍스트에서 setTimeout이 호출된 함수로 호출됩니다. 호출된 함수에 대해서는 this 키워드를 설정하는 일반적인 규칙이 적용되며, this를 설정 혹은 할당하지 않은 경우, non-strict 모드에서 전역(혹은 window) 객체, strict모드에서 undefined를 기본 값으로 합니다. (출처 : mdn) 2번 - What message will eventually be alerted? After how long? var name = "Window"; var alice = { name: "Alice", sayHi: func.. 2020. 1. 10.