Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
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 Respuestas
Responde la pregunta

0

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

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda