javascript detect input box PRESS ENTER

<input type="number" id="year" step="1" min="-3500" max="3500" />
<script>
var input = document.getElementById("year");
input.addEventListener("keyup", function(event) {
  if (event.keyCode === 13) {
    event.preventDefault();
    <Do something>
  }
});
</script>