Front-end/javascript
-
[JavaScript] ⭐️DOM 개념 정리Front-end/javascript 2022. 9. 4. 23:49
모든 객체는 속성 or 메서드를 가지고 있다 1️⃣ Window 객체 History(주소내역), Location(주소표시줄), document(문서), window(창 - 최상위 객체) Window 객체의 속성 일부 innerWidth innerHeight 창의 콘텐츠 영역 폭/높이를 반환 - 스크롤바, 제목표시줄 등은 제외 outerWidth outerHeight 창의 모든 인터페이스 요소(스크롤바 등)를 포함한 폭/높이를 반환 closed 창이 열려 있는지 닫혀 있는지를 Bool 표현식으로 반환 닫혀 있으면 true, 열려 있으면 true 반환 top 현재 창의 최상위 브라우저 창을 반환 예시) Window 객체의 메서드 일부 close 창을 닫는 메서드 - 매개변수X moveBy/To(x,y) 창을..
-
[JS Deep Dive] 04. 변수Front-end/javascript 2022. 8. 23. 22:35
1️⃣ 변수란 무엇이고 왜 필요한가? 💡 컴퓨터는 아래 식을 어떻게 계산할까? 1 + 2 메모리 상의 임의의 위치(메모리 주소)에 1, 2 숫자 값이 각각 저장되고, CPU에서 값을 읽어들여 연산을 수행한다. 연산 결과로 생성된 숫자 3도 메모리 상의 임의의 위치에 저장된다. 😨 만약 연산 결과 3을 재사용하고 싶다면? 3이 저장된 메모리 공간에 직접 접근해야 하지만 오류 발생 확률이 높기 때문에 자바스크립트는 메모리 제어를 허용하지 않는다. 따라서 기억하고 싶은 값을 메모리에 저장하고, 저장된 값을 읽어들여 재사용하기 위해 변수 메커니즘을 사용한다. ⭐️ 변수 : 하나의 값을 저장하기 위해 확보한 메모리 공간 자체 또는 그 메모리 공간을 식별하기 위해 붙인 이름이다 변수를 사용하면 직접 메모리 주소를 ..