function validateCurrentGuess(currentGuess) {

        if (playerWon() || playerLost()) {
          return;
        }

        if (!isValidChar(currentGuess) || guessedChars.includes(currentGuess)) {
          console.log('Invalid guess');
          return;
        }

        guessedChars.push(currentGuess);

        // Is the current guess correct?
        if (answerChars.includes(currentGuess)) {
          printCorrectGuess(currentGuess);
          if (playerWon()) {
            doGameEnd('won');
          }
        }
        else {
          misses++;
          drawHangman(misses - 1);
          if (playerLost()) {
            doGameEnd('lost');
          }
        }

        // Disable the guessed character.
        disableCharacter(currentGuess);
      }
/**
       * Checks if the current guess matches a character in the answer and takes
       * the appropriate next step for the game.
       * @param {string|number} currentGuess Current guess submitted by the
       *   player.
       */
Checks if the current guess matches a character in the answer and takes
the appropriate next step for the game.
@param {string|number} currentGuess Current guess submitted by the
player.
Checks if the current guess matches a character in the answer and takes the appropriate next step for the game . @param { string|number } currentGuess Current guess submitted by the player .
function validateCurrentGuess(currentGuess) {
        if (playerWon() || playerLost()) {
          return;
        }
        if (!isValidChar(currentGuess) || guessedChars.includes(currentGuess)) {
          console.log('Invalid guess');
          return;
        }
        guessedChars.push(currentGuess);
        if (answerChars.includes(currentGuess)) {
          printCorrectGuess(currentGuess);
          if (playerWon()) {
            doGameEnd('won');
          }
        }
        else {
          misses++;
          drawHangman(misses - 1);
          if (playerLost()) {
            doGameEnd('lost');
          }
        }
        disableCharacter(currentGuess);
      }
function validateCurrentGuess ( currentGuess ) { if ( playerWon ( ) || playerLost ( ) ) { return ; } if ( ! isValidChar ( currentGuess ) || guessedChars . includes ( currentGuess ) ) { console . log ( 'Invalid guess' ) ; return ; } guessedChars . push ( currentGuess ) ; if ( answerChars . includes ( currentGuess ) ) { printCorrectGuess ( currentGuess ) ; if ( playerWon ( ) ) { doGameEnd ( 'won' ) ; } } else { misses ++ ; drawHangman ( misses - 1 ) ; if ( playerLost ( ) ) { doGameEnd ( 'lost' ) ; } } disableCharacter ( currentGuess ) ; }
Checks if the current guess matches a character in the answer and takes
 the appropriate next step for the game.
Checks if the current guess matches a character in the answer and takes the appropriate next step for the game .
// Is the current guess correct? // Disable the guessed character.