자바스크립트 기초 문법 정리1. let vs var스코프특징varlet스코프함수 스코프 (function-scoped)블록 스코프 (block-scoped)재선언가능불가능재할당가능가능호이스팅var → 선언은 위로 끌어올려짐, 초기화는 undefinedlet → 선언도 끌어올려지지만 TDZ(Temporal Dead Zone) 존재 → 초기화 전 접근하면 ReferenceError전역 객체 연결 여부var gVar = 1;let gLet = 2;console.log(window.gVar); // 1 ✅console.log(window.gLet); // undefined ❌var는 전역 객체(window)에 붙음let은 블록 스코프이므로 전역 객체에 붙지 않음var = 옛날 방식, 함수 단위 스코프, 호이스팅..