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." );
}