181105 TIL array filter & HanTang skype 회의

» 1막, TIL (Today I Learned)

array 메서드

filter (MDN)

definition: array.filter = The filter() method creates a new array with all elements that pass the test implemented by the provided function.

syntax:

var newArray = arr.filter(callback(element[, index[, array]])[, thisArg])

description:

  • filter() calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a value that coerces to true.

  • callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values.

  • Array elements which do not pass the callback test are simply skipped, and are not included in the new array.

  • callback is invoked which three arguments: 1) the value of the elements 2) the index of the element 3) the Array object being traversed

  • if a [thisArg] parameter is provided to filter, it will be used as the callback’s [this] value. Otherwise, the value [undefined] will be used as its [this] value. the [this] value ultimately observable by callback is determined according to the usual rules for determining the [this] seen by a function. <- 마지막 문장 이해가 잘 안감..

  • filter() does not mutate the array on which it is called. <- 확실히 이해 안감

  • the range of elements processed by filter() is set before the first invocation of callback. Elements which are appended to the array after the call to filter() begins will not be visited by callback.

  • if existing elements of the array are changed, or deleted, their value as passed to callback will be the value at the time filter() visits them; elements that are deleted are not visited.

HanTang skype 회의

  • 각자 구현한 코드를 화면공유하면서 설명해주는 시간을 가졌다. 족보별로 하드코딩한 게 너무 아쉬웠당.
  • 비센스랑 달리는 마크업까지 구현을 해와서 설명해주었는데, 좀 어려워서 막막함을 살짝 느꼈다.
  • 일단 오프라인으로 만나서 자세히 기획하고 역할분담을 하기로 하였다.