뽀미의 개발노트

javascript getMonth()가 한달 전으로 선택될 때 본문

Trouble_Shooting

javascript getMonth()가 한달 전으로 선택될 때

산타는 뽀미 2023. 6. 16. 14:11

const now = new Date();

let month = now.getMonth();

자바스크립트에서 .getMonth()는 달을 0~11까지의 숫자로 가져와서

진짜 지금 몇월인지 알고 싶으면 +1을 해야한다고 한다!!

const now = new Date();

let month = now.getMonth() + 1;

이렇겡!!

그럼 지금까지 한거 다 바꿔야겟넹!!^^