I'm trying to create a button that you click on and it will do the calculations for the user's age and my JavaScript code will write the user's age on the document itself using innerHTML. I don't understand why it's not working. I'm getting no response not even an error.
Here's my JavaScript:
let btn = document.getElementById("btn");
btn.addEventListener('click',howOldAreYou)
function howOldAreYou(){
let age= document.getElementById("year").value
let currentYear = 2021
let howOld= currentYear - age;
document.innerHTML= howOld;
}