This commit is contained in:
Boof 2023-05-19 11:31:57 +02:00 committed by GitHub
parent dca9e1e90c
commit b9ffab746f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -10,6 +10,6 @@
</head>
<body>
<p>If you were born on the 8th of June 2009 you would be</p>
<h3 id="age"><p>Years old</p></h3>
<h3 id="age"></h3>
</body>
</html>

View File

@ -4,5 +4,5 @@ function calculateYearsSince(date) {
return Math.floor(diffInYears);
}
const myDate = new Date('2009-01-01');
document.getElementById("age").innerText = calculateYearsSince(myDate);
const myDate = new Date('2009-08-06');
document.getElementById("age").innerText = calculateYearsSince(myDate); + "<p>Years old</p>"