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

239
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Santiago Trujillo Relatório
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