how to log the input from a input box in js

The HTML consists nothing but an input block and a button

Why does this does not work

let timer = Number(document.querySelector('.timer').value)
document.querySelector('.start').addEventListener('click', function() {
    console.log(timer);
})

This keeps giving me 0 at the console

Whereas this gives the correct output

document.querySelector('.start').addEventListener('click', function() {
    console.log(Number(document.querySelector('.timer').value));
})
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum