title: Why window.addEventListener('keypress', function(e) does not work
body: <p>I have created a simple idea of Hangman game, which runs on console. Everything works, but when I try to use window.addEventListener('keypress, function(e) I cannot press the characters for the game.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const Hangman = function(word, remainguess) {
    this.word = word.toLowerCase().split('')
    this.remainguess = remainguess
    this.guessedLetters = []
  }
  
  Hangman.prototype.getPuzzle = function() {
    let puzzle = ' '
    this.word.forEach(element =&gt; {
      if (this.guessedLetters.includes(element) || element === ' ') {
        puzzle += element
      } else {
        puzzle += '*'
  
  
      }
  
    });
    return puzzle
  
  }
  Hangman.prototype.guessing = function(guess) {
    guess = guess.toLowerCase()
    const isUnique = !this.guessedLetters.includes(guess)
    const isBaddGuess = !this.word.includes(guess)
    if (isUnique) {
      this.guessedLetters.push(guess)
    }
  
    if (isBaddGuess) {
      this.remainguess--
    }
    // return this.remainguess
  }
  const game1 = new Hangman('cat', 1)
  
  window.addEventListener('keypress', function(e) {
    const guess = String.fromCharCode(e.charCode)
    game1.guessing(guess)
    console.log(game1.getPuzzle())
    console.log(game1.remainguess)
  })
  
  
  
     </code></pre>
  </div>
  </div>
  </p>