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

234
Views
How to clear user input in Javascript CodeHS?

I'm using Javascript in CodeHS to create a 10-question quiz asking for user input in each question. After about the fourth question, the user must scroll down through the questions to see the next question they'll have to answer. This is very inconvenient and can get annoying.

Here is a picture of having to scroll down to get to the question the user currently is answering. I'm trying to find a way to clear the user input after each question in Javascript CodeHS, so the user will only be able to see the question they're currently answering, without having to scroll down each time.

Here is my code for reference:

/* Asks the user questions and determines if the user's 
    input answers are emo (or correct) or not. */
function quiz(){
    var score = 0;
    for (var i = 0; i < questions.length; i++){
        var answer = readLine(questions[i]);
        if(answer == correct[i]){
            println("Great!");
            score++;
        } else {
            println("That's not very emo of you, next question!");
        }
    }
    

    /*This variable calculates how emo the user is
        based on the number of correct answers. */
    var calculate = score * 100 / questions.length;
    println("You are: " + calculate + "% emo! Congratulations." );
}

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I have done some research and I think its is only possible on Codehs Java and Python.

about 4 years ago · Santiago Trujillo Report
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!