check if a date is more than 18 years javascript

Solutions on MaxInterview for check if a date is more than 18 years javascript by the best coders in the world

showing results for - "check if a date is more than 18 years javascript"
Sara
20 Apr 2020
1function isOverEighteen(year, month, day) {
2  var now = parseInt(new Date().toISOString().slice(0, 10).replace(/-/g, ''));
3  var dob = year * 10000 + month * 100 + day * 1; // Coerces strings to integers
4
5  return now - dob > 180000;
6}
7