const targetDate = new Date();
const aliasDate = new Date(targetDate);
위와 같이 하면 깊은 복사를 하여 값 자체를 넘겨 준다.
aliasDate의 값을 변경해도 targetDate에는 영향이 없다.
const aliasDate = targetDate;
만약 이와 같이 했다면 aliasDate의 값을 바꿀 때 targetDate의 값도 바뀌게 된다.
참고 자료 :
https://ryusm.tistory.com/137
https://poiemaweb.com/js-date //이건 이 글과는 관련 없고 date 타입에 대해 자세히 나와있음