본문 바로가기

분류 전체보기

(28)
210226 오늘 배운 내용들 OOP prototype과 class를 이용한 상속 패턴 OOP (Object-oriented Programming) jjy0821.tistory.com/14 [JavaScript] OOP in JavaScript 목표 객체 지향 프로그래밍의 특징 이해 인스턴스를 생성 방법 중 es5에서의 방법과, es6의 클래스를 이용한 방법을 이해 다형성(polymorphism), 상속(inheritance)의 개념을 이해 상속관계를 가진 현실세 jjy0821.tistory.com 상속 패턴 jjy0821.tistory.com/16
210225 오늘 배운 내용들 객체 리뷰 객체 지향 자바스크립트 this 키워드 apply, call , bind 객체 지향 프로그래밍 jjy0821.tistory.com/14 실행에 따른 this의 바인딩 패턴 케이스 this의 값 메소드 호출 실행 시점에서 부모인 객체 new 키워드를 이용한 생성자 호출 새롭게 생성된 인스턴스 객체 call 또는 apply 등에 의한 호출 첫 번째 인자로 전달된 객체 화살표 함수는 this의 값에 대해 결정하지 않기 떄문에 함께 사용하지 않는다. Node에서 this는 무엇일까? node에서는 this가 module.exports에 해당한다. module.exports = exports = this 라고 생각하자. call, apply, bind 매개변수 함수 표현 반환값 app..
210224 Node.js와 브라우저의 차이점 Node.js는 DOM이 존재하지 않는다는 것이 브라우저와의 가장 큰 차이점 중 하나다. window와 document 객체 역시 존재하지 않는다는 것인데, Node.js에서는 전역 변수를 다룰 때 window 대신 global 키워드를 사용한다. 또한 fetch API도 존재하지 않는데, 서버에 대한 요청 역시 다른 방법을 사용한다. 프론트엔드에서 Node.js가 가지는 의미 대부분 Node.js가 백엔드 환경이라 생각하는 경우가 많다. 이는 서버를 만들 때 Node.js를 사용할 수 있는 것이 사실이고, 또한 대중적으로 알려진 내용들이 많기 때문이다. 하지만 프론트엔드 개발에서도 다양한 Node.js 모듈들과 npm 생태계를 활용하고 있으며, cli에서 배포 등 자동..
[leetcode] 1748. Sum of Unique Elements Q. You are given an integer array nums. The unique elements of an array are the elements that appear exactly once in the array. Return the sum of all the unique elements of nums. let sumOfUnique = function(nums) { let sum = 0; nums.forEach(function(idx){ if(nums.indexOf(idx)===nums.lastIndexOf(idx)){ sum += idx; } }); return sum; }; 중복되는 요소들을 제외한 수들만 더한 결과를 리턴해야 하므로 indexOf와 lastIndexOf를 이용하여, 두..
210223 # Simple Git Workflow (for Pair programming) upstream 레퍼지토리에서 각 팀원의 remote 레퍼지토리로 fork해온다. remote 레퍼지토리에서 Local로 가져오기 위해 git clone을 통해 clone해온다. driver를 맡은 팀원이 먼저 코드를 작성하고, commit한 후 origin master로 push한다. navigator를 맡았던 팀원은 driver를 맡았던 팀원의 레퍼지토리에서 pull을 통해 수정된 코드를 가져온다. * pull은 fetch와 merge의 성격을 모두 가진다. 일명 '가져와 병합하기'라고 표현 할 수 있다. 원격 저장소의 최신 정보를 내 로컬 저장소에 업데이트 할 수 있도록 만들어 주도록 하는 명령이 pull이다. # Me..
TO-DO-LIST (1) 현재 html, css 까지만 진행. 동적인 리스트 구성 및 디테일한 동작들의 구현 필요. (1) 기능 목록 일정 추가 일정 체크 일정 삭제 (2) 기능 구성에 있어 고려해야할 점 할 일을 적는 입력창과, 내용 업데이트를 위해 클릭할 수 있는 버튼 할 일의 추가 또는 완전한 삭제가 이루어지면 새로운 페이지 렌더링 한 일을 체크할 경우 취소선으로 표시 위로 일정이 추가되는 방향 storage로 일정 정보에 대해 저장하며 관리 더 추가할만한 기능에 대해 생각해보고 로직을 짜보자!
[leetcode] 1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence Q. Given a sentence that consists of some words separated by a single space, and a searchWord. You have to check if searchWord is a prefix of any word in sentence. Return the index of the word in sentence where searchWord is a prefix of this word (1-indexed). If searchWord is a prefix of more than one word, return the index of the first word (minimum index). If there is no such word return -1. A..
[leetcode] 1720. Decode XORed Array Q. There is a hidden integer array arr that consists of n non-negative integers. It was encoded into another integer array encoded of length n - 1, such that encoded[i] = arr[i] XOR arr[i + 1]. For example, if arr = [1,0,2,1], then encoded = [1,2,3]. You are given the encoded array. You are also given an integer first, that is the first element of arr, i.e. arr[0]. Return the original array arr...