Skip to content

Commit

Permalink
hangman: show secret word after player loses
Browse files Browse the repository at this point in the history
  • Loading branch information
David R. Heitzman authored and David R. Heitzman committed Feb 4, 2020
1 parent 2562c97 commit d0b49c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions hangman/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ <h1>Hangman</h1>
<div class="popup-container" id="popup-container">
<div class="popup">
<h2 id="final-message"></h2>
<h3 id="final-message-reveal-word"></h3>
<button id="play-button">Play Again</button>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions hangman/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const playAgainBtn = document.getElementById('play-button');
const popup = document.getElementById('popup-container');
const notification = document.getElementById('notification-container');
const finalMessage = document.getElementById('final-message');
const finalMessageRevealWord = document.getElementById('final-message-reveal-word');

const figureParts = document.querySelectorAll('.figure-part');

Expand Down Expand Up @@ -63,6 +64,7 @@ function updateWrongLettersEl() {
// Check if lost
if (wrongLetters.length === figureParts.length) {
finalMessage.innerText = 'Unfortunately you lost. 😕';
finalMessageRevealWord.innerText = `...the word was: ${selectedWord}`;
popup.style.display = 'flex';

playable = false;
Expand Down

0 comments on commit d0b49c6

Please sign in to comment.