
const birthdate = "19921202";
const today = new Date();
const yyyy = today.getFullYear();
const mm = today.getMonth() < 9 ? "0" + (today.getMonth() + 1) : (today.getMonth() + 1);
const dd = today.getDate() < 10 ? "0" + today.getDate() : today.getDate();
console.log(parseInt(yyyy+mm+dd) - parseInt(birthdate) >= 190000);
'프론트지식' 카테고리의 다른 글
자바스크립트 Prototype 이해하기 (0) | 2023.10.24 |
---|---|
이벤트 루프와 비동기 이해하기 (자바스크립트 동작원리) (2) | 2023.09.13 |
RxJs를 쓰는 이유가 뭘까? (0) | 2022.10.04 |
비밀번호 정규표현식 분리하기 (영문대소문자/숫자특수문자/길이) (0) | 2021.04.06 |