'javascript how to display 10 questions with onclick?

How can I get button.onclick = () => {} function to display 10 questions at once? Instead of creating only 1 question

I have (for 1 question display only)

button.onclick = () => {

createQuestion(characthersQuestion);
 }

I've got to change it to display 10 questions at once, I'm assuming I got to use --for-- + numberofQuestions but I'm not sure.

The api i'm using --> fetch('http://hp-api.herokuapp.com/api/characters')



Solution 1:[1]

I am not 100% sure how to fetch another question, but the way seem to be like this:

button.onclick = () => {
    for (let i=0; i<10; i++){
        //I don't know the api, 
        //I am not sure if this will provide next question or the same as before
        characthersQuestion = fetch('http://hp-api.herokuapp.com/api/characters');
        createQuestion(characthersQuestion);
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ruli