Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!