목록JS (43)
한 걸음씩
▷ 다음과 같은 HTML 요소가 있다고 가정해 보자! ▶ className className은 요소의 클래스 이름을 나타내는 문자열 className 속성을 사용하여 클래스 이름을 가져올 수 있다. const element = document.getElementById('myElement'); console.log(element.className); // 출력: "red-box" https://developer.mozilla.org/ko/docs/Web/API/Element/className Element.className - Web API | MDN className 특정 엘리먼트의 클래스 속성의 값을 가져오거나 설정할 수 있다. developer.mozilla.org ▶ classList classL..

h1{ color: white; } .big-screen{ background-color: blanchedalmond; } .medium-screen{ background-color: palevioletred; } .small-screen{ background-color: cornflowerblue; } const background = document.querySelector('body') const bigSize = 'big-screen' const mediumSize = 'medium-screen' const smallSize = 'small-screen' // 1200이상, 1200미만 900이상, 900미만 function backgroundColor(){ // 창의 너비를 알려줌. 픽셀단위로 ..

https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing Nullish coalescing operator - JavaScript | MDN 널 병합 연산자 (??) 는 왼쪽 피연산자가 null 또는 undefined일 때 오른쪽 피연산자를 반환하고, 그렇지 않으면 왼쪽 피연산자를 반환하는 논리 연산자이다. developer.mozilla.org [문제 상황] const colors = ["#1abc9c", "#3498db", "#9b59b6", "#f39c12", "#e74c3c"]; let index = 0; const superEventHandler = { changeColor: () => {..

WEB HTML CSS JavaScript JavaScript JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic langu..
► Call Stack 스크립트가 함수를 호출하면, 해석기가 콜스텍으로 함수를 추가해서 함수를 불러낸다 stack : 후입선출 구조 const multiply = (x, y) => x * y; const square = x => multiply(x, x); const isRightTriangle = (a, b, c) => ( square(a) + square(b) === square(c) ) console.log("BEFORE") isRightTriangle(3, 4, 5) console.log(isRightTriangle(3, 4, 5)) // true → 25 === 25 console.log("DONEEEE!") ► JavaScript is a single thread + web API consol..