Why the following code does not log pressed keys in input box:

```
const input = document.querySelector('.header--input');
const inputValue = document.querySelector('.header--input').value;

input.addEventListener('keyup', function(e){

    if(inputValue !==''){
        console.log(inputValue);
    }
})

```

but the code below works:

```
const input = document.querySelector('.header--input');

input.addEventListener('keyup', function(e){

    const inputValue = e.target.value;
    if(inputValue !==''){
        console.log(inputValue);
    }
})

```