mirror of
https://github.com/FranP-code/Hangman-game-with-React.git
synced 2025-10-13 00:42:32 +00:00
26 lines
522 B
JavaScript
26 lines
522 B
JavaScript
import Victory from "../Hangman/PuzzleWord/Victory";
|
|
|
|
const CheckVictory = (setIsVictory) => {
|
|
|
|
let allChildrenHaveText = true
|
|
|
|
const puzzleWord = document.getElementById('puzzleWord')
|
|
const childrens = [...puzzleWord.children]
|
|
|
|
childrens.forEach(children => {
|
|
|
|
if (children.textContent === '') {
|
|
allChildrenHaveText = false
|
|
}
|
|
});
|
|
|
|
console.log(allChildrenHaveText)
|
|
|
|
if (allChildrenHaveText) {
|
|
|
|
setIsVictory(true)
|
|
}
|
|
}
|
|
|
|
export default CheckVictory
|