I am making a search bar that needs to detect if the enter key is pressed but I can't seem to find a working option. A little of my code:
<div class="searchbar">
    <input type="text" id="search" placeholder="Search">
  </div>
I tried
let input = document.querySelector('input');
input.addEventListener('keyup', (e) => {   
    if(e.keyCode === 13) {   
        console.log(e.target.value);   
    }   
})   
but keyCode is deprecated. Any advice?
 
    