avatar

Javascript 32

  • Published on
    멍청이라 그런지 `reduce` 함수가 잘 이해 되지 않았다. ## Reduce ```javascript const list = [1, 2, 3, 4, 5]; const initValue = 10; const totalSum = list.reduce( (accumulator, currentValue, currentIndex, array) => { ...
  • Published on
    ## 근데 사실.. 컬렉션 필요없지 않을까 자바스크립트에서 일반적인 Object는 key-value쌍을 끊임 없이 추가할 수 있는 형태로 구성되어 있다. 그래서 사실 컬렉션이 필요하지 않은 것 처럼 보일 수도 있다. 그러나 이따금씩 object로 부족할 때가 있다. - key 충돌 위험이 존재하는 경우 - 문자열/심볼 이외의 키 값이 필요한 경우 - 객...
  • Published on
    ## Javascript Primitive 기존에 자바스크립트는 6가지의 primitive가 있었다. - Object - string - number - boolean - null - undefined 그러나 es6가 들어서면서 `symbol`이라는 7번째 primitive가 추가되었다. ## Symbol ```javascript const hel...
  • Published on
    ![image](https://miro.medium.com/max/1200/1*Et5UjVPGLfF1L43T7ErrxQ.png) ## Javascript Event Capturing https://codepen.io/yceffort/pen/GbVaaY Event Capturing은 특정 요소에서 이벤트가 발생했을 때, 최상위 요소에서 부터 이벤트를 탐...
  • Published on
    # Class 클래스는 기본적으로 이렇게 생겼다. ```javascript class Member { getName() { return "이름"; } } let obj = new Member(); console.log(obj.getName()); ``` ## 특징 ### 1. strict 모드에서 실행 딱히 `'use strict'...