[TIL]201123

슬지로운 개발생활·2020년 11월 23일
0

TIL

목록 보기
39/73
post-thumbnail

1. 코드스테이츠

  • HA

2. TO DO

  • 백준 (if문 끝)
  • 블로깅

3. ETC.

  • 배열 중 중복되는 값 제거
    1. Set (ES6에 등장 : unique 값만 저장해준다)
    [...new Set(array)];
    Array.from(new Set(array));
    1. Filter
    array.filter((item, index) => array.indexOf(item) === index);
    1. Reduce
    array.reduce((unique, item) =>
      unique.includes(item) ? unique : [...unique, item], []);

0개의 댓글