Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[week 8] 주간 결산_이도윤 #25

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

[week 8] 주간 결산_이도윤 #25

wants to merge 20 commits into from

Conversation

doyn511
Copy link
Contributor

@doyn511 doyn511 commented Dec 3, 2023

✨ 이번주 문제 풀이

[Lv 1]

  • 옹알이(2)
  • 숫자 짝꿍
  • 포켓몬
  • 두 개 뽑아서 더하기

[Lv 2]

  • 점프와 순간이동
  • 구명보트

📚 이번주 코테 공부 중 느낀점 / 배운 점

  • 코드는 짧고 간단해도 거기까지 도출해내는 과정이 어렵다는걸 다시 한번 느꼈습니다..
  • [Lv 1] 포켓몬 문제를 풀면서 Set 이라는 자료구조를 처음 사용해보았습니다.

Set : 자바스크립트에서 고유한 값들의 집합을 다루는 자료구조

  • 순서가 없는 중복되지 않은 데이터의 집합
  • ES6에서 추가된 기능
  • 배열과 다르게 데이터를 순서없이 저장 -> 배열처럼 인덱스를 통해 접근 불가능

// Set 생성
const set = new Set( );

// Set 생성 (2)
const set2 = new Set([1,2,3,3,4,2,5]);  // set2의 결과 : {1,2,3,4,5}

// Set에 새로운 값 추가
set.add(추가할 값);

// Set에서 값 삭제
set.delete(삭제할 값); // 값이 set에 존재해 성공적으로 삭제했다면 true. 아니라면 false 반환

// Set에 값 존재 여부 확인
set.has(확인할 값);

// Set 값 개수 확인
console.log(set.size);
  • 배열처럼 set도 forEach() 함수 지원
  • for문 사용할 땐 for ~ of ~ 사용

@doyn511 doyn511 added the 8주차 label Dec 3, 2023
@doyn511 doyn511 self-assigned this Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant