Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
Javascript Hangman game. Printing right letters in the right order

I'm currently building my first javascript game, Hangman. The application is working but if the alphabetical guess is correct it just prints the letter in the guessed order and not in the order of the word itself.

The right guesses ends up in the "rightInputDisplay" Array which i then display as text. Can i maybe somehow print the word based on the correct words index? Any tips or advice?

const gissaOrd = function () {

gissaInput = document.getElementById("gissa").value;
console.log(gissaInput);

// Right guess 

    //Ordarray är ofiltrerad input
    //Gissainput är det man gissat
   

     if (ordArray.includes(gissaInput)) { 

        console.log("du har en rätt boktstav");
        rättArray.push(gissaInput);
        rightInputDisplay = rightInputDisplay + gissaInput;

        // För att få rätt siffra på rätt plats; For-loop över ordArray. Eller kanske rentav köra en for 
        // Loop med ovanstående condition. 

        document.getElementById("rättbokstav").innerHTML = `${rightInputDisplay}`;
        checkWin();
    }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda