728x90
반응형

Front 558

[js] Date 객체끼리 뺄셈(-)

자바스크립트에서는 Date 객체끼리 뺄셈(-)을 하면 자동으로 내부적으로 getTime()이 호출돼서 밀리초(ms) 단위 차이를 반환합니다. 📌 예시const d1 = new Date(2025, 9, 1); // 2025-10-01const d2 = new Date(2025, 9, 31); // 2025-10-31console.log(d2 - d1); // 👉 2592000000 (밀리초 단위, 약 30일)console.log(d2.getTime() - d1.getTime()); // 👉 2592000000 (위 결과와 동일)즉, d2 - d1 은 사실상 d2.getTime() - d1.getTime() 과 같아요. 📌 활용const days = (info.end - info.star..

Front/JS & jQuery 2025.10.04

[js] getTime()

getTime()은 자바스크립트 Date 객체에서 많이 쓰이는 메서드로,해당 날짜를 1970년 1월 1일 00:00:00 UTC부터의 밀리초(ms)로 변환한 숫자를 반환합니다.📌 예시const now = new Date(); console.log(now); // 👉 Tue Oct 01 2025 14:20:00 GMT+0900 (KST)console.log(now.getTime()); // 👉 1759359600000 (밀리초 단위 숫자) 📌 활용 - 두 날짜 차이 구하기const d1 = new Date(2025, 9, 1); // 2025-10-01const d2 = new Date(2025, 9, 31); // 2025-10-31const diffMs = d2.getTime() - d1..

Front/JS & jQuery 2025.10.03

[JAVA] Object.notify()

wait() 과 같이 볼게요.1️⃣ 기본 개념wait()현재 스레드를 일시 정지시키는 메서드모니터 락을 해제하고 다른 스레드가 객체를 사용할 수 있게 함다른 스레드가 notify() 또는 notifyAll()을 호출하면 깨어남반드시 synchronized 블록 안에서 호출해야 함notify()wait()로 대기 중인 스레드 중 하나를 깨움객체의 모니터 락을 소유한 상태에서 호출해야 함notifyAll()은 모든 대기 스레드를 깨움💡 핵심: wait() = 기다림, notify() = 깨움wait()와 notify()는 모든 객체에 존재Object obj = new Object();synchronized(obj) { obj.wait(); // obj 락 해제하고 기다림 obj.notify..

Front/JS & jQuery 2025.09.30

[js]for (const [typeTp, items] of Object.entries(grouped))

1. Object.entries(grouped)Object.entries() 는 객체를 [key, value] 쌍의 배열로 바꿔줍니다.예를 들어:const grouped = { "1": [{ id: 1 }, { id: 2 }], "2": [{ id: 3 }]};console.log(Object.entries(grouped));출력:[ ["1", [{ id: 1 }, { id: 2 }]], ["2", [{ id: 3 }]]]즉, grouped 객체가 { key: value } 구조라면Object.entries(grouped) → [ [key1, value1], [key2, value2], ... ]2. for (const [typeTp, items] of ...)for...of 구문은 배열을 순회할..

Front/JS & jQuery 2025.09.17

[js] toLocaleString

1️⃣ 기본 개념toLocaleString()은 숫자(Number)나 날짜(Date)를 사용자 지역(locale)에 맞는 형식으로 문자열로 변환하는 자바스크립트 메서드입니다.숫자 → 천 단위 구분, 소수점 자리수, 통화 기호 등날짜 → 지역별 날짜/시간 형식 2️⃣ 숫자 예시const num = 1234567.89;console.log(num.toLocaleString()); // 출력: "1,234,567.89" (기본 브라우저 로케일 기준),로 천 단위 구분소수점 유지console.log(num.toLocaleString('de-DE')); // 독일식 출력: "1.234.567,89"독일은 .로 천 단위, ,로 소수점 표시console.log(num.toLocaleString('ko-KR')); /..

Front/JS & jQuery 2025.09.15

[CSS] grid-template-columns, grid-template-rows

grid-column, grid-row에서 몇 칸까지 설정 가능한지는 결국 **그리드를 몇 칸으로 나눴느냐 (grid-template-columns, grid-template-rows)**에 따라 달라져요.1. 칸(셀)의 기준 = grid line (격자선)칸 자체가 아니라 **칸을 구분하는 선(line)**을 기준으로 번호가 매겨집니다.예를 들어 grid-template-columns: repeat(3, 100px); → 3개의 열이 생기면, 선은 4개가 생겨요. 즉, grid-column은 선 번호를 기준으로 "어디서 시작해서 어디까지"를 지정하는 거예요.2. 사용자가 칸 개수 설정몇 칸으로 나눌지는 개발자가 grid-template-columns(가로), grid-template-rows(세로)로 ..

Front/CSS 2025.09.09

[CSS] grid-column, grid-row

grid-column과 grid-row는 CSS Grid Layout에서 아이템이 어느 열(column), 어느 행(row)에 위치할지 제어하는 속성이에요.1. 기본 개념CSS Grid는 행(row)과 열(column)로 나뉜 2차원 레이아웃 시스템.각 셀은 **격자선(Grid line)**으로 구분돼요.grid-column과 grid-row는 아이템이 어느 선부터 어느 선까지 차지할지 지정하는 속성이에요.2. grid-column .item { grid-column: 1 / 3; }➡️ 1번 선부터 3번 선 직전까지 차지 → 즉, 2칸을 가로로 점유.세부 속성grid-column-start: 시작하는 선 번호grid-column-end: 끝나는 선 번호단축형: grid-column: start / en..

Front/CSS 2025.09.08
728x90
반응형