강의

멘토링

커뮤니티

Inflearn Community Q&A

tubowangin4195's profile image
tubowangin4195

asked

Introduction to Javascript Algorithm Problem Solving (Coding Test Preparation)

2. Path search (DFS-adjacency matrix: when the number of nodes is small)

아래의 질문과 연관된 질문입니다.

Written on

·

198

0

let c = Array.from({length : 5}, () => []);
c[0] === c[1]; // false

let d = Array(5).fill([]);
d[0] === d[1]; // true

이렇게 나오더라구요

두 방식의 차이가 뭐길래 저렇게 나오는건가요??

javascript코테 준비 같이 해요!

Answer 1

0

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

아래 질문과 동일한 원리입니다.

2차원을 만들때 얕은 복사냐 깊은 복사냐의 문제입니다.

tubowangin4195's profile image
tubowangin4195

asked

Ask a question