오늘은 JavaScript의 getMonth() 메서드로 달을 구할 시 왜 실제 달보다 1이 적은 값이 반환되는 지에 대해 알아보고자 한다. 1. 개요 자바스크립트에서 날짜를 구하려면 Date 객체를 활용해야 한다. Date객체의 인스턴스의 달(月)을 구하려면 아래 예시의 사용처럼 getMonth() 메서드를 사용한다. const today = new Date(); const year = today.getFullYear(); const month = today.getMonth()+1; const day = today.getDate(); console.log(`${year}.${month}.${day}`) // result: 2024.1.11 (작성일(2024. 01. 11기준) 그런데 왜 getMonth..