I am trying to calculate age using Javascript. The choose their date of birth from an HTML date input type and his/her age should be displayed. How can Javascript use the HTML Date input type data and calculate age?
Below is the HTML
<html>
<head>
<title> Sample Date of Birth Registration</title>
<script type="text/javascript" src="formiteration6.js"></script>
</head>
<body>
<h1>Birth Registration</h1>
<hr />
<form id ="inputFrom">
 <label for="size_1">D.O.B:</label><input type="date" name="size" id="birthDate" value="dd/mm/yy"  />
 <input type='button' onclick='regBirth()' value='Add new person' />
 </form>
 <hr />
<table id="details">
  <tr>
  <th>Date of Birth</th>
  <th>Age</th>
  </tr>
</table>
<h4>Statistics</h1>
<hr />
<h5><b>Total Count:</b></h5>
<p id="count"></p>
</body>
</html>
And Javascript is here
var allPeople = [];
function regBirth() {
    'use strict';
    var myArray = {};
    var actualDob = myArray.actualBirthDate;
    actualDob = document.getElementById('birthDate').value
    allPeople.push(myArray);
    var inputForm = document.getElementById("inputFrom").reset();
    var tabularForm = document.createDocumentFragment();
    var tablerow = document.createElement('tr'); 
    var dob = document.createElement('td');
    dob.innerHTML = actualDob;
    tablerow.appendChild(dob);
    tabularForm.appendChild(tablerow); 
    document.getElementById("details").appendChild(tabularForm);
    var totalPeople = allPeople.length;
    document.getElementById("count").innerHTML=totalPeople;
}
 
     
    
