사이즈와 좌표값 정리 / screenWidth Height, scrollWidth Height, innerWidth Height, outerWidth Height, offsetWidth Height, clientWidth Height & screenX Y, pageX Y, offsetX Y, clientX Y
Width & Height 속성 설명 Window.screenWidth, screenHeight 브라우저 창을 넘어서는, 유저가 보는 스크린 자체의 크기 Element.scrollWidth, scrollHeight 스크롤바로 숨겨진 영역까지 포함한 실제 엘리먼트의 크기 Window.outerWidth, outerHeight 브라우저 창 안의 스크롤바와 메뉴를 포함한 크기 Window.innerWidth, innerHeight 브라우저 창 안의 스크롤바와 메뉴를 제외한 document 크기 Element.offsetWidth, offsetHeight 엘리먼트의 패딩과 보더, 스크롤바의 사이즈를 포함한 크기 Element.clientWidth, clientHeight 엘리먼트의 패딩만 포함한 크기. 보더, ..
자바스크립트 - 스프레드 연산자(Spread Operator)와 나머지 매개변수(Rest Parameter) & 구조 분해 할당(Destructuring Assignment)
Spread Operator는 ES6에서 추가된 문법으로, '...' > 이렇게 하면 자동으로 전달이 된다. 코드상에서 더 의미 있는 이름을 분배하고 싶을 때. const importanceOrder = [“음악”, “코딩”, “운동”] const [1순위, 2순위, 3순위] = importaceOrder; console.log{1순위); // 음악. importaceOrder에 값이 없다면, 기본값도 설정 가능. // (default parameter) const [1순위, 2순위, 3순위, 4순위 = “없음”] = importaceOrder console.log(4순위) // 없음. function createEmoji() { return [‘apple’, ‘사과’]; } const array = c..