강의

멘토링

커뮤니티

Inflearn Community Q&A

slash94941554's profile image
slash94941554

asked

Introduction to Javascript Algorithm Problem Solving (Coding Test Preparation)

4. Finding subsets (binary tree DFS)

로직 이해가 안되는 부분이 있어서 질문드립니다.

Written on

·

289

0

위에 콘솔에서 ch배열의 값들과 ch[i]의 값이 다르게 나오는데

어떤 이유때문에 이런 현상이 생기는 건가요??

javascript코테 준비 같이 해요!

Answer 1

0

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

자바스크립트는 특정 시점에 배열을 출력해도 그 시점의 배열을 출력하는 것이 아니라 DFS가 끝난 최종시점의 배열의 내용을 출력합니다. 

그 시점에 배열의 전체값을 보고 싶으면 for문을 돌리면서 하나하나 다 찍어보세요.

slash94941554's profile image
slash94941554

asked

Ask a question