let body = document.querySelector("body") let container = document.querySelector("#container") let enter = document.querySelector("#enter") let restart = document.querySelector("#restart") let inputArr = [] for (let rowCount = 0; rowCount < 6; rowCount++) { let row = [] inputArr.push(row) for (let column = 0; column < 5; column++) { let space = document.createElement("input") space.classList.add("square") container.appendChild(space) row.push(space) } } function wordle() { let wordSet = ["panic", "dupes", "crate", "great", "soare", "avoid", "knobs", "venom"] let correct = [] let enteredLetters = [] let num = Math.floor(Math.random()*wordSet.length) let word = wordSet[num] console.log(word) let enterClicks = -1 enter.addEventListener("click", () => { enterClicks++ for (let rowVal = 0; rowVal < 6; rowVal++) { for (let col = 0; col<5; col++) { let square = inputArr[rowVal][col] let current = square.value if (current == word[col]) { square.style.backgroundColor = "green" correct.push(current) } if (current !== word[col] && word.indexOf(current) !== -1) { square.style.backgroundColor = "yellow" } if (current == "") { current.disabled = false for (let z = 0; z < 5; z++) { inputArr[rowVal][z].style.backgroundColor = "white" } } if (current !== word[col] && word.indexOf(current) == -1) { square.style.backgroundColor = "darkgray" } } } for (let c = 0; c < 6; c++) { inputArr[enterClicks][c].disabled = true enteredLetters.push(inputArr[enterClicks][c].value) } let foundLetters = [] for (let w = 0; w < 5; w++) { if (correct.indexOf(word[w]) !== -1) { foundLetters.push(word[w]) } } if (foundLetters.length == 5) { window.alert("Congratulations! You Beat Wordle 2.0! Click the 'PLAY AGAIN' button to start a new round.") } }) } wordle() restart.onclick = () => { location.reload() }Por cierto, la matriz de letras encontradas básicamente almacena los caracteres que coinciden tanto en la palabra como en la matriz correcta. Todo lo demás parece estar funcionando perfectamente bien, pero es solo el último fragmento de código, desde la declaración de foundLetters hasta el final, que no parece funcionar como debería.