📜  年龄验证 jquery - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:15.893000             🧑  作者: Mango

代码示例1
var day = 12;
var month = 12;
var year = 2006;
var age = 18;
var setDate = new Date(year + age, month - 1, day);
var currdate = new Date();

if (currdate >= setDate) {
  // you are above 18
  alert("above 18");
} else {
  alert("below 18");
}